summaryrefslogtreecommitdiff
path: root/arch/x86/lib/usercopy_32.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2008-09-10 15:37:17 +0400
committerIngo Molnar <mingo@elte.hu>2008-09-11 11:44:21 +0400
commit3ee1afa308f2a38e5d1e2ad3752ad7abcf480da1 (patch)
tree914e0f3bbd32a387cf6095c6955369fa8da7ebf6 /arch/x86/lib/usercopy_32.c
parentc10d38dda1774ed4540380333cabd229eff37094 (diff)
downloadlinux-3ee1afa308f2a38e5d1e2ad3752ad7abcf480da1.tar.xz
x86: some lock annotations for user copy paths, v2
- introduce might_fault() - handle the atomic user copy paths correctly [ mingo@elte.hu: move might_sleep() outside of in_atomic(). ] Signed-off-by: Nick Piggin <npiggin@suse.de> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/lib/usercopy_32.c')
-rw-r--r--arch/x86/lib/usercopy_32.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index 8eedde2a9cac..7393152a252e 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -32,9 +32,7 @@ static inline int __movsl_is_ok(unsigned long a1, unsigned long a2, unsigned lon
#define __do_strncpy_from_user(dst, src, count, res) \
do { \
int __d0, __d1, __d2; \
- might_sleep(); \
- if (current->mm) \
- might_lock_read(&current->mm->mmap_sem); \
+ might_fault(); \
__asm__ __volatile__( \
" testl %1,%1\n" \
" jz 2f\n" \
@@ -121,9 +119,7 @@ EXPORT_SYMBOL(strncpy_from_user);
#define __do_clear_user(addr,size) \
do { \
int __d0; \
- might_sleep(); \
- if (current->mm) \
- might_lock_read(&current->mm->mmap_sem); \
+ might_fault(); \
__asm__ __volatile__( \
"0: rep; stosl\n" \
" movl %2,%0\n" \
@@ -193,9 +189,7 @@ long strnlen_user(const char __user *s, long n)
unsigned long mask = -__addr_ok(s);
unsigned long res, tmp;
- might_sleep();
- if (current->mm)
- might_lock_read(&current->mm->mmap_sem);
+ might_fault();
__asm__ __volatile__(
" testl %0, %0\n"