alistair23-linux/drivers/pci
Rafael J. Wysocki 8a4c5c329d PCI: Check parent kobject in pci_destroy_dev()
If pci_stop_and_remove_bus_device() is run concurrently for a device and
its parent bridge via remove_callback(), both code paths attempt to acquire
pci_rescan_remove_lock.  If the child device removal acquires it first,
there will be no problems.  However, if the parent bridge removal acquires
it first, it will eventually execute pci_destroy_dev() for the child
device, but that device object will not be freed yet due to the reference
held by the concurrent child removal.  Consequently, both
pci_stop_bus_device() and pci_remove_bus_device() will be executed for that
device unnecessarily and pci_destroy_dev() will see a corrupted list head
in that object.  Moreover, an excess put_device() will be executed for that
device in that case which may lead to a use-after-free in the final
kobject_put() done by sysfs_schedule_callback_work().

To avoid that problem, make pci_destroy_dev() check if the device's parent
kobject is NULL, which only happens after device_del() has already run for
it.  Make pci_destroy_dev() return immediately whithout doing anything in
that case.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2014-01-15 10:34:13 -07:00
..
host Merge branch 'pci/host-mvebu' into next 2014-01-07 17:34:14 -07:00
hotplug PCI: hotplug: Use global PCI rescan-remove locking 2014-01-14 12:14:25 -07:00
pcie Merge branch 'pci/dead-code' into next 2014-01-13 16:47:08 -07:00
access.c PCI: Remove unused pci_vpd_truncate() 2014-01-13 11:14:43 -07:00
ats.c PCI: Removed unused parts of Page Request Interface support 2014-01-10 14:00:47 -07:00
bus.c Merge branch 'pci/resource' into next 2014-01-10 14:23:15 -07:00
host-bridge.c PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev 2013-12-21 10:06:10 -07:00
hotplug-pci.c
htirq.c
ioapic.c PCI: Convert ioapic to be builtin only, not modular 2014-01-03 14:31:38 -07:00
iov.c PCI: Clear NumVFs when disabling SR-IOV in sriov_init() 2013-11-22 14:53:27 -07:00
irq.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
Kconfig PCI: Convert ioapic to be builtin only, not modular 2014-01-03 14:31:38 -07:00
Makefile PCI: Add Virtual Channel to save/restore support 2013-12-17 17:39:08 -07:00
msi.c Merge branch 'pci/msi' into next 2014-01-07 17:34:39 -07:00
of.c
pci-acpi.c PCI: Use dev_is_pci() to identify PCI devices 2013-12-09 16:42:53 -07:00
pci-driver.c PCI: Disable Bus Master only on kexec reboot 2013-12-07 14:20:28 -07:00
pci-label.c PCI: Reorder so actual code comes before stubs 2014-01-13 17:01:11 -07:00
pci-stub.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
pci-sysfs.c PCI: Add global pci_lock_rescan_remove() 2014-01-13 17:49:49 -07:00
pci.c Merge branch 'pci/dead-code' into next 2014-01-13 16:47:08 -07:00
pci.h PCI: Make local functions static 2014-01-13 11:57:29 -07:00
probe.c PCI: Add global pci_lock_rescan_remove() 2014-01-13 17:49:49 -07:00
proc.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
quirks.c PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev 2013-12-21 10:06:10 -07:00
remove.c PCI: Check parent kobject in pci_destroy_dev() 2014-01-15 10:34:13 -07:00
rom.c PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev 2013-12-21 10:06:10 -07:00
search.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
setup-bus.c Merge branch 'pci/resource' into next 2014-01-10 14:23:15 -07:00
setup-irq.c
setup-res.c PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev 2013-12-21 10:06:10 -07:00
slot.c PCI: Remove unused pci_renumber_slot() 2014-01-13 11:14:44 -07:00
syscall.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
vc.c PCI: Rename PCI_VC_PORT_REG1/2 to PCI_VC_PORT_CAP1/2 2013-12-17 17:49:39 -07:00
vpd.c
xen-pcifront.c xen/pcifront: Use global PCI rescan-remove locking 2014-01-15 10:34:13 -07:00