riscv: fix locking violation in page fault handler
authorAndreas Schwab <schwab@suse.de>
Tue, 7 May 2019 07:36:46 +0000 (09:36 +0200)
committerPalmer Dabbelt <palmer@sifive.com>
Fri, 17 May 2019 03:42:13 +0000 (20:42 -0700)
When a user mode process accesses an address in the vmalloc area
do_page_fault tries to unlock the mmap semaphore when it isn't locked.

Signed-off-by: Andreas Schwab <schwab@suse.de>
[Palmer: Duplicated code instead of a goto]
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
arch/riscv/mm/fault.c

index 26293bc053a8cc059964525bffe424d6b22208de..cec8be9e2d6aca1049945fc0a4200f0ef36071b0 100644 (file)
@@ -229,8 +229,9 @@ vmalloc_fault:
                pte_t *pte_k;
                int index;
 
+               /* User mode accesses just cause a SIGSEGV */
                if (user_mode(regs))
-                       goto bad_area;
+                       return do_trap(regs, SIGSEGV, code, addr, tsk);
 
                /*
                 * Synchronize this task's top level page-table