]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
riscv: Avoid enabling interrupts in die()
authorMattias Nissler <mnissler@rivosinc.com>
Wed, 15 Feb 2023 14:48:28 +0000 (14:48 +0000)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:47:40 +0000 (16:47 +0100)
commit3be1346c0fe50a197b0a9785041c7537f73dc097
treed7282b3c5c32c972e4c9589256da507f167cdd94
parent8c07c086d8df556b926b73c292d06bbd009d0b05
riscv: Avoid enabling interrupts in die()

BugLink: https://bugs.launchpad.net/bugs/2011425
commit 130aee3fd9981297ff9354e5d5609cd59aafbbea upstream.

While working on something else, I noticed that the kernel would start
accepting interrupts again after crashing in an interrupt handler. Since
the kernel is already in inconsistent state, enabling interrupts is
dangerous and opens up risk of kernel state deteriorating further.
Interrupts do get enabled via what looks like an unintended side effect of
spin_unlock_irq, so switch to the more cautious
spin_lock_irqsave/spin_unlock_irqrestore instead.

Fixes: 76d2a0493a17 ("RISC-V: Init and Halt Code")
Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Link: https://lore.kernel.org/r/20230215144828.3370316-1-mnissler@rivosinc.com
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
arch/riscv/kernel/traps.c