diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-09-11 23:44:35 +0200 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-09-15 18:19:38 +0200 |
commit | 70279f38568703022d4790d382d1f6462f8b6383 (patch) | |
tree | 0a62c3151a4c15a30c49b2ccaead4d63ecfa413a /kernel | |
parent | bbcd86fa91e60af29c3de9a38aa28c314468cc5f (diff) |
futex: Unlock hb->lock in futex_wait_requeue_pi() error path
commit 13c42c2f43b19aab3195f2d357db00d1e885eaa8 upstream.
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@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1409112318500.4178@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/futex.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index f94695c9d38b..e4b9b60e25b1 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2465,6 +2465,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(&q, hb); ret = -EINVAL; goto out_put_keys; } |