[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-13c42c2f43b19aab3195f2d357db00d1e885eaa8@git.kernel.org>
Date: Fri, 12 Sep 2014 13:10:16 -0700
From: tip-bot for Thomas Gleixner <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...nel.org,
a.p.zijlstra@...llo.nl, dvhart@...ux.intel.com, davej@...hat.com,
dave@...olabs.net, tglx@...utronix.de
Subject: [tip:locking/urgent] futex: Unlock hb->
lock in futex_wait_requeue_pi() error path
Commit-ID: 13c42c2f43b19aab3195f2d357db00d1e885eaa8
Gitweb: http://git.kernel.org/tip/13c42c2f43b19aab3195f2d357db00d1e885eaa8
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Thu, 11 Sep 2014 23:44:35 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 12 Sep 2014 22:04:36 +0200
futex: Unlock hb->lock in futex_wait_requeue_pi() error path
futex_wait_requeue_pi() calls futex_wait_setup(). If
futex_wait_setup() succeeds it returns with hb->lock held and
preemption disabled. Now the sanity check after this does:
if (match_futex(&q.key, &key2)) {
ret = -EINVAL;
goto out_put_keys;
}
which releases the keys but does not release hb->lock.
So we happily return to user space with hb->lock held and therefor
preemption disabled.
Unlock hb->lock before taking the exit route.
Reported-by: Dave "Trinity" Jones <davej@...hat.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Darren Hart <dvhart@...ux.intel.com>
Reviewed-by: Davidlohr Bueso <dave@...olabs.net>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: stable@...r.kernel.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1409112318500.4178@nanos
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
kernel/futex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/futex.c b/kernel/futex.c
index d3a9d94..815d7af 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2592,6 +2592,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
* shared futexes. We need to compare the keys:
*/
if (match_futex(&q.key, &key2)) {
+ queue_unlock(hb);
ret = -EINVAL;
goto out_put_keys;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists