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.
This commit is contained in:
Brian Gianforcaro 2021-06-06 16:34:03 -07:00 committed by Andreas Kling
parent 9fccbde371
commit 77f4f6e0de
Notes: sideshowbarker 2024-07-18 12:43:26 +09:00

View file

@ -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;
}