From 2596e3d0d802e288c840e113d444c25e22d361be Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Tue, 26 May 2026 19:38:29 +0800 Subject: [PATCH] riscv: kgdb: Fix a missing irq restore issue on an early-return path If kgdb_handle_exception() fails, the local_irq_restore() is not called and the function returns to the caller with interrupts still disabled. To fix it, add the missing irq restore here. Fixes: fe89bd2be866 ("riscv: Add KGDB support") Cc: stable@vger.kernel.org Signed-off-by: Hui Wang Signed-off-by: Linux RISC-V bot --- arch/riscv/kernel/kgdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/kgdb.c b/arch/riscv/kernel/kgdb.c index 0bf629204c76a4..1956e4840a3022 100644 --- a/arch/riscv/kernel/kgdb.c +++ b/arch/riscv/kernel/kgdb.c @@ -337,8 +337,10 @@ static int kgdb_riscv_notify(struct notifier_block *self, unsigned long cmd, local_irq_save(flags); if (kgdb_handle_exception(type == KGDB_SW_SINGLE_STEP ? 0 : 1, - args->signr, cmd, regs)) + args->signr, cmd, regs)) { + local_irq_restore(flags); return NOTIFY_DONE; + } if (type == KGDB_COMPILED_BREAK) regs->epc += 4;