mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel/futex.c: fix incorrect 'should_fail_futex' handling
@ 2020-09-27  0:08 mateusznosek0
  2020-10-28 14:53 ` [tip: locking/urgent] futex: Fix incorrect should_fail_futex() handling tip-bot2 for Mateusz Nosek
  0 siblings, 1 reply; 2+ messages in thread
From: mateusznosek0 @ 2020-09-27  0:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mateusz Nosek, tglx, mingo

From: Mateusz Nosek <mateusznosek0@gmail.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@gmail.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-28 21:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27  0:08 [PATCH] kernel/futex.c: fix incorrect 'should_fail_futex' handling mateusznosek0
2020-10-28 14:53 ` [tip: locking/urgent] futex: Fix incorrect should_fail_futex() handling tip-bot2 for Mateusz Nosek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®