]> git.baikalelectronics.ru Git - kernel.git/commit
futex: Ensure the correct return value from futex_lock_pi()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 20 Jan 2021 15:00:24 +0000 (16:00 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 26 Jan 2021 14:10:58 +0000 (15:10 +0100)
commit9120ef2447b7883692d383427846135a81f55b47
tree0eb8ee3e490e16e316d22cab5ce09e16ff0176c8
parentc8d4b05b0e0f99dcae6bb046585e664df3f0b86b
futex: Ensure the correct return value from futex_lock_pi()

In case that futex_lock_pi() was aborted by a signal or a timeout and the
task returned without acquiring the rtmutex, but is the designated owner of
the futex due to a concurrent futex_unlock_pi() fixup_owner() is invoked to
establish consistent state. In that case it invokes fixup_pi_state_owner()
which in turn tries to acquire the rtmutex again. If that succeeds then it
does not propagate this success to fixup_owner() and futex_lock_pi()
returns -EINTR or -ETIMEOUT despite having the futex locked.

Return success from fixup_pi_state_owner() in all cases where the current
task owns the rtmutex and therefore the futex and propagate it correctly
through fixup_owner(). Fixup the other callsite which does not expect a
positive return value.

Fixes: a890e1a72556 ("futex: Avoid violating the 10th rule of futex")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
kernel/futex.c