[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <mvm5zqmu35d.fsf@suse.de>
Date: Tue, 07 May 2019 09:36:46 +0200
From: Andreas Schwab <schwab@...e.de>
To: linux-riscv@...ts.infradead.org
CC: linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...e.de>
---
arch/riscv/mm/fault.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index 88401d5125bc..c51878e5a66a 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -181,6 +181,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
up_read(&mm->mmap_sem);
/* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) {
+bad_area_do_trap:
do_trap(regs, SIGSEGV, code, addr, tsk);
return;
}
@@ -230,7 +231,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
int index;
if (user_mode(regs))
- goto bad_area;
+ goto bad_area_do_trap;
/*
* Synchronize this task's top level page-table
--
2.21.0
--
Andreas Schwab, SUSE Labs, schwab@...e.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Powered by blists - more mailing lists