summaryrefslogtreecommitdiff
path: root/arch/x86/lib/usercopy_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/lib/usercopy_64.c')
-rw-r--r--arch/x86/lib/usercopy_64.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index f4df6e7c718b..847d12945998 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -16,6 +16,8 @@
do { \
long __d0, __d1, __d2; \
might_sleep(); \
+ if (current->mm) \
+ might_lock_read(&current->mm->mmap_sem); \
__asm__ __volatile__( \
" testq %1,%1\n" \
" jz 2f\n" \
@@ -65,6 +67,8 @@ unsigned long __clear_user(void __user *addr, unsigned long size)
{
long __d0;
might_sleep();
+ if (current->mm)
+ might_lock_read(&current->mm->mmap_sem);
/* no memory constraint because it doesn't change any memory gcc knows
about */
asm volatile(