aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-02-15 06:08:34 -0500
committerThomas Gleixner <tglx@linutronix.de>2012-02-15 06:19:13 -0500
commit59263b513c11398cd66a52d4c5b2b118ce1e0359 (patch)
tree1d5b73add630265a638e5de0ebc2be0940b629e6 /kernel
parentf07fdec50a13f134ea9608c8fb3f6408c58ef55e (diff)
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')
-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,
2629 } 2629 }
2630 2630
2631 switch (cmd) { 2631 switch (cmd) {
2632 case FUTEX_LOCK_PI:
2633 case FUTEX_UNLOCK_PI:
2634 case FUTEX_TRYLOCK_PI:
2635 case FUTEX_WAIT_REQUEUE_PI:
2636 case FUTEX_CMP_REQUEUE_PI:
2637 if (!futex_cmpxchg_enabled)
2638 return -ENOSYS;
2639 }
2640
2641 switch (cmd) {
2632 case FUTEX_WAIT: 2642 case FUTEX_WAIT:
2633 val3 = FUTEX_BITSET_MATCH_ANY; 2643 val3 = FUTEX_BITSET_MATCH_ANY;
2634 case FUTEX_WAIT_BITSET: 2644 case FUTEX_WAIT_BITSET:
@@ -2649,16 +2659,13 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2649 ret = futex_wake_op(uaddr, flags, uaddr2, val, val2, val3); 2659 ret = futex_wake_op(uaddr, flags, uaddr2, val, val2, val3);
2650 break; 2660 break;
2651 case FUTEX_LOCK_PI: 2661 case FUTEX_LOCK_PI:
2652 if (futex_cmpxchg_enabled) 2662 ret = futex_lock_pi(uaddr, flags, val, timeout, 0);
2653 ret = futex_lock_pi(uaddr, flags, val, timeout, 0);
2654 break; 2663 break;
2655 case FUTEX_UNLOCK_PI: 2664 case FUTEX_UNLOCK_PI:
2656 if (futex_cmpxchg_enabled) 2665 ret = futex_unlock_pi(uaddr, flags);
2657 ret = futex_unlock_pi(uaddr, flags);
2658 break; 2666 break;
2659 case FUTEX_TRYLOCK_PI: 2667 case FUTEX_TRYLOCK_PI:
2660 if (futex_cmpxchg_enabled) 2668 ret = futex_lock_pi(uaddr, flags, 0, timeout, 1);
2661 ret = futex_lock_pi(uaddr, flags, 0, timeout, 1);
2662 break; 2669 break;
2663 case FUTEX_WAIT_REQUEUE_PI: 2670 case FUTEX_WAIT_REQUEUE_PI:
2664 val3 = FUTEX_BITSET_MATCH_ANY; 2671 val3 = FUTEX_BITSET_MATCH_ANY;