]> git.baikalelectronics.ru Git - kernel.git/commit
futex: Fix incorrect should_fail_futex() handling
authorMateusz Nosek <mateusznosek0@gmail.com>
Sun, 27 Sep 2020 00:08:58 +0000 (02:08 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 28 Oct 2020 14:48:51 +0000 (15:48 +0100)
commit4f3f6af68e911550d7386268ccb0c3803152de7c
tree9b4401cb0791023cb74c27a94633ccbf7691d1cf
parenta6b39bb4c4fbb3a8ddb9fba5c29f3c2b1568232f
futex: Fix incorrect should_fail_futex() handling

If should_futex_fail() returns true in futex_wake_pi(), then the 'ret'
variable is set to -EFAULT and then immediately overwritten. So the failure
injection is non-functional.

Fix it by actually leaving the function and returning -EFAULT.

The Fixes tag is kinda blury because the initial commit which introduced
failure injection was already sloppy, but the below mentioned commit broke
it completely.

[ tglx: Massaged changelog ]

Fixes: e09c355509c3 ("locking/futex: Allow low-level atomic operations to return -EAGAIN")
Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200927000858.24219-1-mateusznosek0@gmail.com
kernel/futex.c