linux/debian/patches/features/all/rt/0009-futex-UP-futex_atomic_...

39 lines
1.2 KiB
Diff

From bde8ee0656280daad7779ecb33190b1eda475bc2 Mon Sep 17 00:00:00 2001
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
Date: Mon, 11 May 2015 17:52:14 +0200
Subject: [PATCH 09/14] futex: UP futex_atomic_cmpxchg_inatomic() relies on
disabled preemption
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.0/patches-4.0.5-rt3.tar.xz
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.
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
---
include/asm-generic/futex.h | 2 ++
1 file changed, 2 insertions(+)
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -107,6 +107,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval,
{
u32 val;
+ preempt_disable();
if (unlikely(get_user(val, uaddr) != 0))
return -EFAULT;
@@ -114,6 +115,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval,
return -EFAULT;
*uval = val;
+ preempt_enable();
return 0;
}