]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
hexagon: Fix unbalanced spinlock in die()
authorLin Yujun <linyujun809@huawei.com>
Mon, 22 May 2023 02:56:08 +0000 (02:56 +0000)
committerBrian Cain <brian.cain@oss.qualcomm.com>
Fri, 31 Jan 2025 02:46:06 +0000 (18:46 -0800)
die executes holding the spinlock of &die.lock and unlock
it after printing the oops message.
However in the code if the notify_die() returns NOTIFY_STOP
, die() exit with returning 1 but never unlocked the spinlock.

Fix this by adding spin_unlock_irq(&die.lock) before returning.

Fixes: cf9750bae262 ("Hexagon: Provide basic debugging and system trap support.")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
Link: https://lore.kernel.org/r/20230522025608.2515558-1-linyujun809@huawei.com
Signed-off-by: Brian Cain <bcain@quicinc.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
arch/hexagon/kernel/traps.c

index 73bddcfa8ca6ba75e49a53a676ef1e5fb2ea37f0..e732aa01c2ff02e45021c6276d69213a840b1417 100644 (file)
@@ -195,8 +195,10 @@ int die(const char *str, struct pt_regs *regs, long err)
        printk(KERN_EMERG "Oops: %s[#%d]:\n", str, ++die.counter);
 
        if (notify_die(DIE_OOPS, str, regs, err, pt_cause(regs), SIGSEGV) ==
-           NOTIFY_STOP)
+           NOTIFY_STOP) {
+               spin_unlock_irq(&die.lock);
                return 1;
+       }
 
        print_modules();
        show_regs(regs);