kernel/thread: Fix team double lock when reaching thread limit.

The team is locked for the allocation of the user thread. When the
thread limit is reached, the user thread is removed again by
team_free_user_thread which internally locks the team, resulting in a
double lock. Unlock the teamLocker before calling team_free_user_thread.

Amazingly noone seems to ever have hit the thread limit, even though it
is currently at an arbitrarily low 4096.
This commit is contained in:
Michael Lotz 2020-06-13 23:15:01 +02:00
parent 3cd10d35ab
commit e65c8deae2

View File

@ -1029,6 +1029,7 @@ thread_create_thread(const ThreadCreationAttributes& attributes, bool kernel)
thread->user_thread = NULL;
threadLocker.Unlock();
teamLocker.Unlock();
if (userThread != NULL)
team_free_user_thread(team, userThread);