diff --git a/[refs] b/[refs] index 61adf519e0c8..a3711f2ad35b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 67cc7e26a5c46508ee00b9fe169aad833b798025 +refs/heads/master: ac205b7bb72fa4227d2e79979bbe2b4687cdf44d diff --git a/trunk/drivers/pci/remove.c b/trunk/drivers/pci/remove.c index ef8b18c48f26..82f8ae572703 100644 --- a/trunk/drivers/pci/remove.c +++ b/trunk/drivers/pci/remove.c @@ -144,7 +144,15 @@ static void pci_stop_bus_devices(struct pci_bus *bus) { struct list_head *l, *n; - list_for_each_safe(l, n, &bus->devices) { + /* + * VFs could be removed by pci_remove_bus_device() in the + * pci_stop_bus_devices() code path for PF. + * aka, bus->devices get updated in the process. + * but VFs are inserted after PFs when SRIOV is enabled for PF, + * We can iterate the list backwards to get prev valid PF instead + * of removed VF. + */ + list_for_each_prev_safe(l, n, &bus->devices) { struct pci_dev *dev = pci_dev_b(l); pci_stop_bus_device(dev); }