[PATCH] riscv: kgdb: Fix a missing irq restore issue on an early-return path
Hui Wang
hui.wang at canonical.com
Tue May 26 04:38:29 PDT 2026
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 at vger.kernel.org
Signed-off-by: Hui Wang <hui.wang at canonical.com>
---
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 0bf629204c76..1956e4840a30 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;
--
2.43.0
More information about the linux-riscv
mailing list