1
0
Fork 0
remarkable-linux/drivers/pci
Lukas Wunner b5b7417ed9 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>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-24 13:09:23 +02:00
..
dwc PCI: exynos: Fix a potential init_clk_resources NULL pointer dereference 2018-07-22 14:28:42 +02:00
endpoint PCI: endpoint: Fix find_first_zero_bit() usage 2018-03-24 11:01:26 +01:00
host PCI: versatile: Fix I/O space page leak 2018-08-24 13:09:19 +02:00
hotplug PCI: pciehp: Fix unprotected list iteration in IRQ handler 2018-08-24 13:09:23 +02:00
pcie PCI/ASPM: Deal with missing root ports in link state handling 2018-03-08 22:41:25 -08:00
switch Merge branch 'pci/switchtec' into next 2017-07-02 18:51:10 -05:00
Kconfig PCI: Provide Kconfig option for lockless config space accessors 2017-06-28 22:32:56 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
access.c PCI: Provide Kconfig option for lockless config space accessors 2017-06-28 22:32:56 +02:00
ats.c PCI: Restore PRI and PASID state after Function-Level Reset 2017-05-30 15:40:50 -05:00
bus.c PCI: Autosense device removal in pci_bridge_d3_update() 2016-11-17 18:44:56 -06:00
ecam.c PCI: ECAM: Map config region with pci_remap_cfgspace() 2017-04-24 13:53:14 -05:00
host-bridge.c cxl: use pcibios_free_controller_deferred() when removing vPHBs 2016-08-22 11:09:33 +10:00
hotplug-pci.c
htirq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iov.c PCI: Create SR-IOV virtfn/physfn links before attaching driver 2017-12-25 14:26:26 +01:00
irq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmap.c PCI: Add I/O BAR support to generic pci_mmap_resource_range() 2017-04-20 08:47:47 -05:00
msi.c pci-v4.14-changes 2017-09-08 15:47:43 -07:00
of.c
pci-acpi.c ACPI / PCI: Bail early in acpi_pci_add_bus() if there is no ACPI handle 2018-08-09 12:16:38 +02:00
pci-driver.c PCI: Restore config space on runtime resume despite being unbound 2018-05-30 07:52:32 +02:00
pci-label.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci-mid.c PCI / PM: Simplify device wakeup settings code 2017-06-28 01:52:45 +02:00
pci-stub.c
pci-sysfs.c PCI: Prevent sysfs disable of device while driver is attached 2018-08-03 07:50:29 +02:00
pci.c PCI: OF: Fix I/O space page leak 2018-08-24 13:09:19 +02:00
pci.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
probe.c PCI: Skip MPS logic for Virtual Functions (VFs) 2018-08-24 13:09:22 +02:00
proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quirks.c PCI: Add ACS quirk for Intel 300 series 2018-07-03 11:24:55 +02:00
remove.c PCI: Detach driver before procfs & sysfs teardown on device remove 2017-12-20 10:10:32 +01:00
rom.c PCI: Add comments about ROM BAR updating 2016-11-29 18:05:09 -06:00
search.c PCI: Add device flag PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT 2017-04-13 18:49:50 -05:00
setup-bus.c PCI: Fix calculation of bridge window's size and alignment 2017-04-18 14:47:20 -05:00
setup-irq.c PCI: Inline and remove pcibios_update_irq() 2017-08-10 12:49:57 -05:00
setup-res.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
slot.c locking/atomic, kref: Add kref_read() 2017-01-14 11:37:18 +01:00
syscall.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vc.c PCI: Fix unaligned accesses in VC code 2016-06-20 13:24:20 -05:00
vpd.c
xen-pcifront.c xen: make use of xenbus_read_unsigned() in xen-pcifront 2016-11-07 13:55:26 +01:00