Subject: CVE-2024-42140: riscv: kexec: Avoid deadlock in kexec crash path

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

riscv: kexec: Avoid deadlock in kexec crash path

If the kexec crash code is called in the interrupt context, the
machine_kexec_mask_interrupts() function will trigger a deadlock while
trying to acquire the irqdesc spinlock and then deactivate irqchip in
irq_set_irqchip_state() function.

Unlike arm64, riscv only requires irq_eoi handler to complete EOI and
keeping irq_set_irqchip_state() will only leave this possible deadlock
without any use. So we simply remove it.

The Linux kernel CVE team has assigned CVE-2024-42140 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.15.82 with commit 12f237200c16 and fixed in 5.15.163 with commit bb80a7911218
	Issue introduced in 6.1 with commit b17d19a5314a and fixed in 6.1.98 with commit 653deee48a46
	Issue introduced in 6.1 with commit b17d19a5314a and fixed in 6.6.39 with commit 7692c9b6baac
	Issue introduced in 6.1 with commit b17d19a5314a and fixed in 6.9.9 with commit 484dd545271d
	Issue introduced in 6.1 with commit b17d19a5314a and fixed in 6.10 with commit c562ba719df5
	Issue introduced in 6.0.12 with commit 7594956fec89

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-42140
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	arch/riscv/kernel/machine_kexec.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/bb80a7911218bbab2a69b5db7d2545643ab0073d
	https://git.kernel.org/stable/c/653deee48a4682ea17a05b96fb6842795ab5943c
	https://git.kernel.org/stable/c/7692c9b6baacdee378435f58f19baf0eb69e4155
	https://git.kernel.org/stable/c/484dd545271d02d1571e1c6b62ea7df9dbe5e692
	https://git.kernel.org/stable/c/c562ba719df570c986caf0941fea2449150bcbc4