diff options
author | Romain Perier <romain.perier@free-electrons.com> | 2016-04-14 09:36:03 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-04-21 05:06:09 -0400 |
commit | fba7cd681b6155e2d93e7862fcd6f970336b83c3 (patch) | |
tree | 7204cd2e2e821bde02b0279fd610b7139e82d51d | |
parent | fe1bce9e2107ba3a8faffe572483b6974201a0e6 (diff) |
asm-generic/futex: Re-enable preemption in futex_atomic_cmpxchg_inatomic()
The recent decoupling of pagefault disable and preempt disable added an
explicit preempt_disable/enable() pair to the futex_atomic_cmpxchg_inatomic()
implementation in asm-generic/futex.h. But it forgot to add preempt_enable()
calls to the error handling code pathes, which results in a preemption count
imbalance.
This is observable on boot when the test for atomic_cmpxchg() is calling
futex_atomic_cmpxchg_inatomic() on a NULL pointer.
Add the missing preempt_enable() calls to the error handling code pathes.
[ tglx: Massaged changelog ]
Fixes: d9b9ff8c1889 ("sched/preempt, futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly")
Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
Cc: linux-arch@vger.kernel.org
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1460640963-690-1-git-send-email-romain.perier@free-electrons.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/asm-generic/futex.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h index e56272c919b5..bf2d34c9d804 100644 --- a/include/asm-generic/futex.h +++ b/include/asm-generic/futex.h | |||
@@ -108,11 +108,15 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
108 | u32 val; | 108 | u32 val; |
109 | 109 | ||
110 | preempt_disable(); | 110 | preempt_disable(); |
111 | if (unlikely(get_user(val, uaddr) != 0)) | 111 | if (unlikely(get_user(val, uaddr) != 0)) { |
112 | preempt_enable(); | ||
112 | return -EFAULT; | 113 | return -EFAULT; |
114 | } | ||
113 | 115 | ||
114 | if (val == oldval && unlikely(put_user(newval, uaddr) != 0)) | 116 | if (val == oldval && unlikely(put_user(newval, uaddr) != 0)) { |
117 | preempt_enable(); | ||
115 | return -EFAULT; | 118 | return -EFAULT; |
119 | } | ||
116 | 120 | ||
117 | *uval = val; | 121 | *uval = val; |
118 | preempt_enable(); | 122 | preempt_enable(); |