Skip to content

Commit 147ea50

Browse files
committed
Merge branch 'pci/dpc'
- If there's a device below a bridge, prevent a use-after-free by holding a reference to the device while waiting for the secondary bus to be ready in case the device is concurrently removed, e.g., by DPC (Lukas Wunner) * pci/dpc: PCI/DPC: Fix use-after-free on concurrent DPC and hot-removal
2 parents 06bbe25 + 11a1f4b commit 147ea50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/pci/pci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4823,7 +4823,7 @@ static int pci_bus_max_d3cold_delay(const struct pci_bus *bus)
48234823
*/
48244824
int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type)
48254825
{
4826-
struct pci_dev *child;
4826+
struct pci_dev *child __free(pci_dev_put) = NULL;
48274827
int delay;
48284828

48294829
if (pci_dev_is_disconnected(dev))
@@ -4852,8 +4852,8 @@ int pci_bridge_wait_for_secondary_bus(struct pci_dev *dev, char *reset_type)
48524852
return 0;
48534853
}
48544854

4855-
child = list_first_entry(&dev->subordinate->devices, struct pci_dev,
4856-
bus_list);
4855+
child = pci_dev_get(list_first_entry(&dev->subordinate->devices,
4856+
struct pci_dev, bus_list));
48574857
up_read(&pci_bus_sem);
48584858

48594859
/*

0 commit comments

Comments
 (0)