]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:08:38 +0000 (11:08 +0100)
commitae5aa5685c7cc1def1e07e0ab562087c5b8c78e7
treea4b5b4e1ef7d0c3836fe60f6b3bf6b9fa96db68b
parentb19305641e3c0c4b3758606b7bf6e57256094a1f
futex: Fix incorrect should_fail_futex() handling

[ Upstream commit 921c7ebd1337d1a46783d7e15a850e12aed2eaa0 ]

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: 6b4f4bc9cb22 ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/futex.c