From 8fef9900d43feb9d5017c72840966733085e3e82 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 7 May 2019 09:36:46 +0200 Subject: riscv: fix locking violation in page fault handler 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 [Palmer: Duplicated code instead of a goto] Signed-off-by: Palmer Dabbelt --- arch/riscv/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/riscv/mm/fault.c') diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 26293bc053a8..cec8be9e2d6a 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -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 -- cgit v1.2.3