linux/drivers/pci/hotplug
Lukas Wunner c28c5c78a8 PCI: pciehp: Fix unprotected list iteration in IRQ handler
commit 1204e35bed upstream.

Commit b440bde74f ("PCI: Add pci_ignore_hotplug() to ignore hotplug
events for a device") iterates over the devices on a hotplug port's
subordinate bus in pciehp's IRQ handler without acquiring pci_bus_sem.
It is thus possible for a user to cause a crash by concurrently
manipulating the device list, e.g. by disabling slot power via sysfs
on a different CPU or by initiating a remove/rescan via sysfs.

This can't be fixed by acquiring pci_bus_sem because it may sleep.
The simplest fix is to avoid the list iteration altogether and just
check the ignore_hotplug flag on the port itself.  This works because
pci_ignore_hotplug() sets the flag both on the device as well as on its
parent bridge.

We do lose the ability to print the name of the device blocking hotplug
in the debug message, but that's probably bearable.

Fixes: b440bde74f ("PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
[bwh: Backported to 3.16: s/events/intr_loc/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-12-16 22:08:19 +00:00
..
acpi_pcihp.c ACPI: Eliminate the DEVICE_ACPI_HANDLE() macro 2013-11-14 23:17:21 +01:00
acpiphp.h ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges 2014-06-11 21:08:49 +02:00
acpiphp_core.c PCI: Move EXPORT_SYMBOL so it immediately follows function/variable 2014-06-10 13:36:10 -06:00
acpiphp_glue.c ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status() 2018-10-21 08:44:58 +01:00
acpiphp_ibm.c ACPI: Clean up inclusions of ACPI header files 2013-12-07 01:03:14 +01:00
cpci_hotplug.h PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpci_hotplug_core.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpci_hotplug_pci.c PCI: cpcihp: Add missing curly braces in cpci_configure_slot() 2015-04-27 16:16:33 +01:00
cpcihp_generic.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpcihp_zt5550.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpcihp_zt5550.h PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
cpqphp.h PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpqphp_core.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
cpqphp_ctrl.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpqphp_nvram.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpqphp_nvram.h PCI: Remove "extern" from function declarations 2013-04-17 10:21:17 -06:00
cpqphp_pci.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpqphp_sysfs.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
ibmphp.h PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
ibmphp_core.c PCI: ibmphp: Fix use-before-set in get_max_bus_speed() 2018-11-20 18:04:49 +00:00
ibmphp_ebda.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
ibmphp_hpc.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
ibmphp_pci.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
ibmphp_res.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
Kconfig PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
Makefile PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
pci_hotplug_core.c PCI: hotplug: Don't leak pci_slot on registration failure 2018-12-16 22:08:18 +00:00
pciehp.h PCI: pciehp: Fix use-after-free on unplug 2018-12-16 22:08:19 +00:00
pciehp_acpi.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
pciehp_core.c PCI: pciehp: Fix use-after-free on unplug 2018-12-16 22:08:19 +00:00
pciehp_ctrl.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
pciehp_hpc.c PCI: pciehp: Fix unprotected list iteration in IRQ handler 2018-12-16 22:08:19 +00:00
pciehp_pci.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
pcihp_skeleton.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
pcihp_slot.c PCI: hotplug: Remove unnecessary "dev->bus" test 2014-04-14 16:06:30 -06:00
rpadlpar.h PCI: Remove "extern" from function declarations 2013-04-17 10:21:17 -06:00
rpadlpar_core.c powerpc/pci/rpadlpar: Fix device reference leaks 2017-03-16 02:26:20 +00:00
rpadlpar_sysfs.c PCI: introduce pci_slot 2008-06-10 14:37:03 -07:00
rpaphp.h PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
rpaphp_core.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
rpaphp_pci.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
rpaphp_slot.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
s390_pci_hpc.c PCI: Remove unnecessary includes of <linux/init.h> 2014-04-14 16:12:37 -06:00
sgi_hotplug.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
shpchp.h PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
shpchp_core.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
shpchp_ctrl.c PCI: shpchp: Fix AMD POGO identification 2018-11-20 18:05:09 +00:00
shpchp_hpc.c PCI: shpchp: Enable bridge bus mastering if MSI is enabled 2017-11-26 13:50:16 +00:00
shpchp_pci.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
shpchp_sysfs.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00