Skip to content

Commit 8fef990

Browse files
andreas-schwabpalmer-dabbelt
authored andcommitted
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 <[email protected]> [Palmer: Duplicated code instead of a goto] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent a967a28 commit 8fef990

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/riscv/mm/fault.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
229229
pte_t *pte_k;
230230
int index;
231231

232+
/* User mode accesses just cause a SIGSEGV */
232233
if (user_mode(regs))
233-
goto bad_area;
234+
return do_trap(regs, SIGSEGV, code, addr, tsk);
234235

235236
/*
236237
* Synchronize this task's top level page-table

0 commit comments

Comments
 (0)