From: Vincent Chen <[email protected]>

[ Upstream commit e0c0fc18f10d5080cddde0e81505fd3e952c20c4 ]

On RISC-V, when the kernel runs code on behalf of a user thread, and the
kernel executes a WARN() or WARN_ON(), the user thread will be sent
a bogus SIGTRAP.  Fix the RISC-V kernel code to not send a SIGTRAP when
a WARN()/WARN_ON() is executed.

Signed-off-by: Vincent Chen <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
[[email protected]: fixed subject]
Signed-off-by: Paul Walmsley <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
 arch/riscv/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index 055a937aca70a..82f42a55451eb 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -134,7 +134,7 @@ asmlinkage void do_trap_break(struct pt_regs *regs)
                        break;
                case BUG_TRAP_TYPE_WARN:
                        regs->sepc += get_break_insn_length(regs->sepc);
-                       break;
+                       return;
                case BUG_TRAP_TYPE_BUG:
 #endif /* CONFIG_GENERIC_BUG */
                default:
-- 
2.20.1

Reply via email to