summaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-02-15 12:08:34 +0100
committerThomas Gleixner <tglx@linutronix.de>2012-02-15 12:19:13 +0100
commit59263b513c11398cd66a52d4c5b2b118ce1e0359 (patch)
tree1d5b73add630265a638e5de0ebc2be0940b629e6 /kernel/futex.c
parentf07fdec50a13f134ea9608c8fb3f6408c58ef55e (diff)
downloadlinux-59263b513c11398cd66a52d4c5b2b118ce1e0359.tar.gz
linux-59263b513c11398cd66a52d4c5b2b118ce1e0359.tar.bz2
linux-59263b513c11398cd66a52d4c5b2b118ce1e0359.zip
futex: Cover all PI opcodes with cmpxchg enabled check
Some of the newer futex PI opcodes do not check the cmpxchg enabled variable and call unconditionally into the handling functions. Cover all PI opcodes in a separate check. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org Cc: Peter Zijlstra <peterz@infradead.org> Cc: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index ea87f4d2f455..4b1c4b6a339c 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2629,6 +2629,16 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
}
switch (cmd) {
+ case FUTEX_LOCK_PI:
+ case FUTEX_UNLOCK_PI:
+ case FUTEX_TRYLOCK_PI:
+ case FUTEX_WAIT_REQUEUE_PI:
+ case FUTEX_CMP_REQUEUE_PI:
+ if (!futex_cmpxchg_enabled)
+ return -ENOSYS;
+ }
+
+ switch (cmd) {
case FUTEX_WAIT:
val3 = FUTEX_BITSET_MATCH_ANY;
case FUTEX_WAIT_BITSET:
@@ -2649,16 +2659,13 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
ret = futex_wake_op(uaddr, flags, uaddr2, val, val2, val3);
break;
case FUTEX_LOCK_PI:
- if (futex_cmpxchg_enabled)
- ret = futex_lock_pi(uaddr, flags, val, timeout, 0);
+ ret = futex_lock_pi(uaddr, flags, val, timeout, 0);
break;
case FUTEX_UNLOCK_PI:
- if (futex_cmpxchg_enabled)
- ret = futex_unlock_pi(uaddr, flags);
+ ret = futex_unlock_pi(uaddr, flags);
break;
case FUTEX_TRYLOCK_PI:
- if (futex_cmpxchg_enabled)
- ret = futex_lock_pi(uaddr, flags, 0, timeout, 1);
+ ret = futex_lock_pi(uaddr, flags, 0, timeout, 1);
break;
case FUTEX_WAIT_REQUEUE_PI:
val3 = FUTEX_BITSET_MATCH_ANY;