aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2019-05-07 09:36:46 +0200
committerPalmer Dabbelt <palmer@sifive.com>2019-05-16 20:42:13 -0700
commit8fef9900d43feb9d5017c72840966733085e3e82 (patch)
tree6343590c54c1b8c5e1d74f83e0da13d1d7e0a92f
parentRISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs (diff)
downloadlinux-dev-8fef9900d43feb9d5017c72840966733085e3e82.tar.xz
linux-dev-8fef9900d43feb9d5017c72840966733085e3e82.zip
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 <schwab@suse.de> [Palmer: Duplicated code instead of a goto] Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
-rw-r--r--arch/riscv/mm/fault.c3
1 files changed, 2 insertions, 1 deletions
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