Commit 015ee789 authored by Lin Yujun's avatar Lin Yujun Committed by Wentao Guan
Browse files

hexagon: Fix unbalanced spinlock in die()

stable inclusion
from stable-v6.6.76
commit aa420dee339299e04c7edac70f71864c66f05503
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBW08Q

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=aa420dee339299e04c7edac70f71864c66f05503



--------------------------------

[ Upstream commit 03410e87563a122075c3721acc7d5510e41d8332 ]

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: cf9750ba ("Hexagon: Provide basic debugging and system trap support.")
Signed-off-by: default avatarLin Yujun <linyujun809@huawei.com>
Link: https://lore.kernel.org/r/20230522025608.2515558-1-linyujun809@huawei.com


Signed-off-by: default avatarBrian Cain <bcain@quicinc.com>
Signed-off-by: default avatarBrian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit aa420dee339299e04c7edac70f71864c66f05503)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 88a91200
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);