]> git.ipfire.org Git - people/arne_f/kernel.git/commit
futex: Fix incorrect should_fail_futex() handling
authorMateusz Nosek <mateusznosek0@gmail.com>
Sun, 28 Mar 2021 20:43:10 +0000 (22:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:41:42 +0000 (14:41 +0200)
commitcec1580fb04c83c2d4300843469be2107ca21d04
treeb5a1fb8bde9bf9ab1d00f48fe1ed43944d80eb6c
parentb90aa237f469c3575190a5e6a855b76ad1d2ce94
futex: Fix incorrect should_fail_futex() handling

commit 921c7ebd1337d1a46783d7e15a850e12aed2eaa0 upstream.

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/futex.c