Subject: CVE-2024-46761: pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv

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

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

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

pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv

The hotplug driver for powerpc (pci/hotplug/pnv_php.c) causes a kernel
crash when we try to hot-unplug/disable the PCIe switch/bridge from
the PHB.

The crash occurs because although the MSI data structure has been
released during disable/hot-unplug path and it has been assigned
with NULL, still during unregistration the code was again trying to
explicitly disable the MSI which causes the NULL pointer dereference and
kernel crash.

The patch fixes the check during unregistration path to prevent invoking
pci_disable_msi/msix() since its data structure is already freed.

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

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

	Fixed in 4.19.322 with commit 4eb4085c1346
	Fixed in 5.4.284 with commit c4c681999d38
	Fixed in 5.10.226 with commit bc1faed19db9
	Fixed in 5.15.167 with commit c0d8094dc740
	Fixed in 6.1.110 with commit 438d52222737
	Fixed in 6.6.51 with commit b82d4d5c736f
	Fixed in 6.10.10 with commit bfc44075b197
	Fixed in 6.11 with commit 335e35b74852

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-46761
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:
	drivers/pci/hotplug/pnv_php.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/4eb4085c1346d19d4a05c55246eb93e74e671048
	https://git.kernel.org/stable/c/c4c681999d385e28f84808bbf3a85ea8e982da55
	https://git.kernel.org/stable/c/bc1faed19db95abf0933b104910a3fb01b138f59
	https://git.kernel.org/stable/c/c0d8094dc740cfacf3775bbc6a1c4720459e8de4
	https://git.kernel.org/stable/c/438d522227374042b5c8798f8ce83bbe479dca4d
	https://git.kernel.org/stable/c/b82d4d5c736f4fd2ed224c35f554f50d1953d21e
	https://git.kernel.org/stable/c/bfc44075b19740d372f989f21dd03168bfda0689
	https://git.kernel.org/stable/c/335e35b748527f0c06ded9eebb65387f60647fda