Re: [PATCH] asm-generic/futex: Properly re-enable preemption in futex_atomic_cmpxchg_inatomic()
From: Peter Zijlstra
Date: Thu Apr 14 2016 - 11:45:12 EST
On Thu, Apr 14, 2016 at 03:36:03PM +0200, Romain Perier wrote:
> Fixes: d9b9ff8c1889 ("sched/preempt, futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly")
> Signed-off-by: Romain Perier <romain.perier@xxxxxxxxxxxxxxxxxx>
> ---
> include/asm-generic/futex.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
> index e56272c..bf2d34c 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,
> u32 val;
>
> preempt_disable();
> - if (unlikely(get_user(val, uaddr) != 0))
> + if (unlikely(get_user(val, uaddr) != 0)) {
> + preempt_enable();
> return -EFAULT;
> + }
>
> - if (val == oldval && unlikely(put_user(newval, uaddr) != 0))
> + if (val == oldval && unlikely(put_user(newval, uaddr) != 0)) {
> + preempt_enable();
> return -EFAULT;
> + }
>
> *uval = val;
> preempt_enable();
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>