aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/uaccess_32.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/uaccess_32.h')
-rw-r--r--include/asm-x86/uaccess_32.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/asm-x86/uaccess_32.h b/include/asm-x86/uaccess_32.h
index 6fdef39a0bcb..d725e2d703f7 100644
--- a/include/asm-x86/uaccess_32.h
+++ b/include/asm-x86/uaccess_32.h
@@ -82,8 +82,10 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
82static __always_inline unsigned long __must_check 82static __always_inline unsigned long __must_check
83__copy_to_user(void __user *to, const void *from, unsigned long n) 83__copy_to_user(void __user *to, const void *from, unsigned long n)
84{ 84{
85 might_sleep(); 85 might_sleep();
86 return __copy_to_user_inatomic(to, from, n); 86 if (current->mm)
87 might_lock_read(&current->mm->mmap_sem);
88 return __copy_to_user_inatomic(to, from, n);
87} 89}
88 90
89static __always_inline unsigned long 91static __always_inline unsigned long
@@ -138,6 +140,8 @@ static __always_inline unsigned long
138__copy_from_user(void *to, const void __user *from, unsigned long n) 140__copy_from_user(void *to, const void __user *from, unsigned long n)
139{ 141{
140 might_sleep(); 142 might_sleep();
143 if (current->mm)
144 might_lock_read(&current->mm->mmap_sem);
141 if (__builtin_constant_p(n)) { 145 if (__builtin_constant_p(n)) {
142 unsigned long ret; 146 unsigned long ret;
143 147
@@ -160,6 +164,8 @@ static __always_inline unsigned long __copy_from_user_nocache(void *to,
160 const void __user *from, unsigned long n) 164 const void __user *from, unsigned long n)
161{ 165{
162 might_sleep(); 166 might_sleep();
167 if (current->mm)
168 might_lock_read(&current->mm->mmap_sem);
163 if (__builtin_constant_p(n)) { 169 if (__builtin_constant_p(n)) {
164 unsigned long ret; 170 unsigned long ret;
165 171