hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/riscv/kernel/traps.c
....@@ -31,25 +31,29 @@
3131 {
3232 static int die_counter;
3333 int ret;
34
+ long cause;
35
+ unsigned long flags;
3436
3537 oops_enter();
3638
37
- spin_lock_irq(&die_lock);
39
+ spin_lock_irqsave(&die_lock, flags);
3840 console_verbose();
3941 bust_spinlocks(1);
4042
4143 pr_emerg("%s [#%d]\n", str, ++die_counter);
4244 print_modules();
43
- show_regs(regs);
45
+ if (regs)
46
+ show_regs(regs);
4447
45
- ret = notify_die(DIE_OOPS, str, regs, 0, regs->cause, SIGSEGV);
48
+ cause = regs ? regs->cause : -1;
49
+ ret = notify_die(DIE_OOPS, str, regs, 0, cause, SIGSEGV);
4650
47
- if (regs && kexec_should_crash(current))
51
+ if (kexec_should_crash(current))
4852 crash_kexec(regs);
4953
5054 bust_spinlocks(0);
5155 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
52
- spin_unlock_irq(&die_lock);
56
+ spin_unlock_irqrestore(&die_lock, flags);
5357 oops_exit();
5458
5559 if (in_interrupt())
....@@ -57,7 +61,7 @@
5761 if (panic_on_oops)
5862 panic("Fatal exception");
5963 if (ret != NOTIFY_STOP)
60
- do_exit(SIGSEGV);
64
+ make_task_dead(SIGSEGV);
6165 }
6266
6367 void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr)