From 77f4f6e0dea39461d5a806f376455546df4e727d Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 6 Jun 2021 16:34:03 -0700 Subject: [PATCH] Kernel: Fix error propagation if Thread::WaitBlocker constructor fails There is logic at the end of the constructor that sets m_should_block to false if we encountered errors. We were missing this step due to the erroneous early return, the code then ended up waiting and then asserting on unblock since the WaitBlocker is in a invalid state. This fix is to not return early, and let normal control flow handle it. Fixes: #7857 Verified with `stress-ng --yield=10` locally. --- Kernel/ThreadBlockers.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp index 98a9e71bd6..1b866f33a2 100644 --- a/Kernel/ThreadBlockers.cpp +++ b/Kernel/ThreadBlockers.cpp @@ -599,7 +599,6 @@ Thread::WaitBlocker::WaitBlocker(int wait_options, idtype_t id_type, pid_t id, K if (!m_waitee || m_waitee->ppid() != Process::current()->pid()) { m_result = ECHILD; m_error = true; - return; } break; } @@ -608,7 +607,6 @@ Thread::WaitBlocker::WaitBlocker(int wait_options, idtype_t id_type, pid_t id, K if (!m_waitee_group) { m_result = ECHILD; m_error = true; - return; } break; }