summaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-08-15 23:29:10 +0200
committerIngo Molnar <mingo@kernel.org>2021-08-17 19:05:46 +0200
commit59c7ecf1544e1841b5be8847e81bc9842f838e7e (patch)
tree943d42e4333b1588a2c6f793cd1c8ba73e6366be /kernel/futex.c
parent8e74633dcefb280f2cefb49b7201d99650243d96 (diff)
downloadlinux-stable-59c7ecf1544e1841b5be8847e81bc9842f838e7e.tar.gz
linux-stable-59c7ecf1544e1841b5be8847e81bc9842f838e7e.tar.bz2
linux-stable-59c7ecf1544e1841b5be8847e81bc9842f838e7e.zip
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 <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210815211305.416427548@linutronix.de
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 8ddc87cae25c..543974285676 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.