Commit-ID: d9b9ff8c18891d74dc7076800bde81b774f7d032 Gitweb: http://git.kernel.org/tip/d9b9ff8c18891d74dc7076800bde81b774f7d032 Author: David Hildenbrand <dahi@xxxxxxxxxxxxxxxxxx> AuthorDate: Mon, 11 May 2015 17:52:14 +0200 Committer: Ingo Molnar <mingo@xxxxxxxxxx> CommitDate: Tue, 19 May 2015 08:39:16 +0200 sched/preempt, futex: Disable preemption in UP futex_atomic_cmpxchg_inatomic() explicitly Let's explicitly disable/enable preemption in the !CONFIG_SMP version of futex_atomic_cmpxchg_inatomic(), to prepare for pagefault_disable() not touching preemption anymore. This is needed for this function to be callable from both, atomic and non-atomic context. Otherwise we might break mutual exclusion when relying on a get_user()/ put_user() implementation. Reviewed-and-tested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: David Hildenbrand <dahi@xxxxxxxxxxxxxxxxxx> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Cc: David.Laight@xxxxxxxxxx Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: airlied@xxxxxxxx Cc: akpm@xxxxxxxxxxxxxxxxxxxx Cc: benh@xxxxxxxxxxxxxxxxxxx Cc: bigeasy@xxxxxxxxxxxxx Cc: borntraeger@xxxxxxxxxx Cc: daniel.vetter@xxxxxxxxx Cc: heiko.carstens@xxxxxxxxxx Cc: herbert@xxxxxxxxxxxxxxxxxxx Cc: hocko@xxxxxxx Cc: hughd@xxxxxxxxxx Cc: mst@xxxxxxxxxx Cc: paulus@xxxxxxxxx Cc: ralf@xxxxxxxxxxxxxx Cc: schwidefsky@xxxxxxxxxx Cc: yang.shi@xxxxxxxxxxxxx Link: http://lkml.kernel.org/r/1431359540-32227-10-git-send-email-dahi@xxxxxxxxxxxxxxxxxx Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx> --- include/asm-generic/futex.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h index 3586017..e56272c 100644 --- a/include/asm-generic/futex.h +++ b/include/asm-generic/futex.h @@ -107,6 +107,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, { u32 val; + preempt_disable(); if (unlikely(get_user(val, uaddr) != 0)) return -EFAULT; @@ -114,6 +115,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, return -EFAULT; *uval = val; + preempt_enable(); return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |