CVE-2024-42302
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
17/08/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
PCI/DPC: Fix use-after-free on concurrent DPC and hot-removal<br />
<br />
Keith reports a use-after-free when a DPC event occurs concurrently to<br />
hot-removal of the same portion of the hierarchy:<br />
<br />
The dpc_handler() awaits readiness of the secondary bus below the<br />
Downstream Port where the DPC event occurred. To do so, it polls the<br />
config space of the first child device on the secondary bus. If that<br />
child device is concurrently removed, accesses to its struct pci_dev<br />
cause the kernel to oops.<br />
<br />
That&#39;s because pci_bridge_wait_for_secondary_bus() neglects to hold a<br />
reference on the child device. Before v6.3, the function was only<br />
called on resume from system sleep or on runtime resume. Holding a<br />
reference wasn&#39;t necessary back then because the pciehp IRQ thread<br />
could never run concurrently. (On resume from system sleep, IRQs are<br />
not enabled until after the resume_noirq phase. And runtime resume is<br />
always awaited before a PCI device is removed.)<br />
<br />
However starting with v6.3, pci_bridge_wait_for_secondary_bus() is also<br />
called on a DPC event. Commit 53b54ad074de ("PCI/DPC: Await readiness<br />
of secondary bus after reset"), which introduced that, failed to<br />
appreciate that pci_bridge_wait_for_secondary_bus() now needs to hold a<br />
reference on the child device because dpc_handler() and pciehp may<br />
indeed run concurrently. The commit was backported to v5.10+ stable<br />
kernels, so that&#39;s the oldest one affected.<br />
<br />
Add the missing reference acquisition.<br />
<br />
Abridged stack trace:<br />
<br />
BUG: unable to handle page fault for address: 00000000091400c0<br />
CPU: 15 PID: 2464 Comm: irq/53-pcie-dpc 6.9.0<br />
RIP: pci_bus_read_config_dword+0x17/0x50<br />
pci_dev_wait()<br />
pci_bridge_wait_for_secondary_bus()<br />
dpc_reset_link()<br />
pcie_do_recovery()<br />
dpc_handler()
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.10.224 (excluding) | |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.165 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.103 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.44 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.10.3 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/11a1f4bc47362700fcbde717292158873fb847ed
- https://git.kernel.org/stable/c/2c111413f38ca5cf87557cab89f6d82b0e3433e7
- https://git.kernel.org/stable/c/2cc8973bdc4d6c928ebe38b88090a2cdfe81f42f
- https://git.kernel.org/stable/c/b16f3ea1db47a6766a9f1169244cf1fc287a7c62
- https://git.kernel.org/stable/c/c52f9e1a9eb40f13993142c331a6cfd334d4b91d
- https://git.kernel.org/stable/c/f63df70b439bb8331358a306541893bf415bf1da
- https://lists.debian.org/debian-lts-announce/2024/10/msg00003.html
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



