ARM: 8414/1: __copy_to_user_memcpy: fix mmap semaphore usage
authorNicolas Pitre <nicolas.pitre@linaro.org>
Wed, 12 Aug 2015 15:45:02 +0000 (16:45 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 18 Aug 2015 12:59:59 +0000 (13:59 +0100)
The mmap semaphore should not be taken when page faults are disabled.
Since pagefault_disable() no longer disables preemption, we now need
to use faulthandler_disabled() in place of in_atomic().

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/lib/uaccess_with_memcpy.c

index 3e58d710013c3ad9b377fc76e6dad58f377e88a7..4b39af2dfda9963345afe18c89131c1056a90b41 100644 (file)
@@ -96,7 +96,7 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n)
        }
 
        /* the mmap semaphore is taken only if not in an atomic context */
-       atomic = in_atomic();
+       atomic = faulthandler_disabled();
 
        if (!atomic)
                down_read(&current->mm->mmap_sem);