[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200927000858.24219-1-mateusznosek0@gmail.com>
Date: Sun, 27 Sep 2020 02:08:58 +0200
From: mateusznosek0@...il.com
To: linux-kernel@...r.kernel.org
Cc: Mateusz Nosek <mateusznosek0@...il.com>, tglx@...utronix.de,
mingo@...hat.com
Subject: [PATCH] kernel/futex.c: fix incorrect 'should_fail_futex' handling
From: Mateusz Nosek <mateusznosek0@...il.com>
Previously if 'futex_should_fail' returned true, then only 'ret' variable
was set, which was later overwritten without being read. The patch fixes
the problem.
Signed-off-by: Mateusz Nosek <mateusznosek0@...il.com>
---
kernel/futex.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/futex.c b/kernel/futex.c
index a5876694a60e..39681bf8b06c 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1502,8 +1502,10 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_
*/
newval = FUTEX_WAITERS | task_pid_vnr(new_owner);
- if (unlikely(should_fail_futex(true)))
+ if (unlikely(should_fail_futex(true))) {
ret = -EFAULT;
+ goto out_unlock;
+ }
ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval);
if (!ret && (curval != uval)) {
--
2.20.1
Powered by blists - more mailing lists