diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-09-20 19:09:48 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-09-20 19:10:54 -0400 |
commit | 94bb346480f8646871e5547491b5746ae0a643c3 (patch) | |
tree | 56bec45b0079145ea4a0e8aec552ab44dd1f51f9 /drivers/pci/iov.c | |
parent | 9b9a6d261616bed589302bc6244c5bd7c99a733f (diff) |
Revert "PCI: Use hotplug-safe pci_get_domain_bus_and_slot()"
This reverts commit 433efd2247b0cbf5e7e86275e1f21281d3b99047.
When we remove an SR-IOV device, we have this call chain:
driver .remove() method
pci_disable_sriov()
sriov_disable()
virtfn_remove()
pci_get_domain_bus_and_slot()
sriov_disable() is only called for PFs, not for VFs. When it's called
for a PF, it loops through all the VFs and calls virtfn_remove() for
each. But we stop and remove VFs before PFs, so by the time we get
to virtfn_remove(), the VFs have already been stopped and deleted
from the device list. Now pci_get_domain_bus_and_slot(), which uses
bus_find_device() and relies on that device list, doesn't find the
VFs, so the VF references aren't released correctly.
Reported-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/iov.c')
-rw-r--r-- | drivers/pci/iov.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index b0fe7712b4d4..aeccc911abb8 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c | |||
@@ -152,11 +152,15 @@ failed1: | |||
152 | static void virtfn_remove(struct pci_dev *dev, int id, int reset) | 152 | static void virtfn_remove(struct pci_dev *dev, int id, int reset) |
153 | { | 153 | { |
154 | char buf[VIRTFN_ID_LEN]; | 154 | char buf[VIRTFN_ID_LEN]; |
155 | struct pci_bus *bus; | ||
155 | struct pci_dev *virtfn; | 156 | struct pci_dev *virtfn; |
156 | struct pci_sriov *iov = dev->sriov; | 157 | struct pci_sriov *iov = dev->sriov; |
157 | 158 | ||
158 | virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), | 159 | bus = pci_find_bus(pci_domain_nr(dev->bus), virtfn_bus(dev, id)); |
159 | virtfn_bus(dev, id), virtfn_devfn(dev, id)); | 160 | if (!bus) |
161 | return; | ||
162 | |||
163 | virtfn = pci_get_slot(bus, virtfn_devfn(dev, id)); | ||
160 | if (!virtfn) | 164 | if (!virtfn) |
161 | return; | 165 | return; |
162 | 166 | ||