Skip to contentSkip to conversation

CVE-2024-56561: PCI: endpoint: Fix PCI domain ID release in pci_epc_destroy()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 27, 2024

lore
Share & tools
lore
#0 lore raw

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

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

PCI: endpoint: Fix PCI domain ID release in pci_epc_destroy()

pci_epc_destroy() invokes pci_bus_release_domain_nr() to release the PCI domain ID, but there are two issues:

- 'epc->dev' is passed to pci_bus_release_domain_nr() which was already freed by device_unregister(), leading to a use-after-free issue.

- Domain ID corresponds to the EPC device parent, so passing 'epc->dev' is also wrong.

Fix these issues by passing 'epc->dev.parent' to pci_bus_release_domain_nr() and also do it before device_unregister().

[mani: reworded subject and description]

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

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

	Issue introduced in 6.12 with commit 0328947c50324cf4b2d8b181bf948edb8101f59f and fixed in 6.12.4 with commit c74a1df6c2a2df7dd45c3fc1a5edc29a075dcf22
	Issue introduced in 6.12 with commit 0328947c50324cf4b2d8b181bf948edb8101f59f and fixed in 6.13-rc1 with commit 4acc902ed3743edd4ac2d3846604a99d17104359
	Issue introduced in 6.11.4 with commit a4934cd7a18d35fc57025f23773f6f19e2b2dbb1

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-56561

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/endpoint/pci-epc-core.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/c74a1df6c2a2df7dd45c3fc1a5edc29a075dcf22
	https://git.kernel.org/stable/c/4acc902ed3743edd4ac2d3846604a99d17104359