From e65c8deae2bc8c8c9cd9285794ef926177bb9e8c Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 13 Jun 2020 23:15:01 +0200 Subject: [PATCH] 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. --- src/system/kernel/thread.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/system/kernel/thread.cpp b/src/system/kernel/thread.cpp index 8376684992..b8e6d2ac96 100644 --- a/src/system/kernel/thread.cpp +++ b/src/system/kernel/thread.cpp @@ -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);