From: Thomas Gleixner Date: Sun, 15 Aug 2021 21:29:10 +0000 (+0200) Subject: futex: Correct the number of requeued waiters for PI X-Git-Tag: accepted/tizen/unified/20230118.172025~6489^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59c7ecf1544e1841b5be8847e81bc9842f838e7e;p=platform%2Fkernel%2Flinux-rpi.git futex: Correct the number of requeued waiters for PI The accounting is wrong when either the PI sanity check or the requeue PI operation fails. Adjust it in the failure path. Will be simplified in the next step. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20210815211305.416427548@linutronix.de --- diff --git a/kernel/futex.c b/kernel/futex.c index 8ddc87c..5439742 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2116,6 +2116,8 @@ retry_private: /* Ensure we requeue to the expected futex for requeue_pi. */ if (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) { + /* Don't account for it */ + task_count--; ret = -EINVAL; break; } @@ -2157,6 +2159,8 @@ retry_private: */ this->pi_state = NULL; put_pi_state(pi_state); + /* Don't account for it */ + task_count--; /* * We stop queueing more waiters and let user * space deal with the mess.