1
0
Fork 0
remarkable-linux/drivers/pci/hotplug
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
..
Kconfig
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acpi_pcihp.c
acpiphp.h
acpiphp_core.c
acpiphp_glue.c ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status() 2018-04-24 09:36:25 +02:00
acpiphp_ibm.c
cpci_hotplug.h
cpci_hotplug_core.c
cpci_hotplug_pci.c
cpcihp_generic.c
cpcihp_zt5550.c PCI: Constify hotplug pci_device_id structures 2017-08-10 15:21:42 -05:00
cpcihp_zt5550.h
cpqphp.h
cpqphp_core.c PCI: Constify hotplug pci_device_id structures 2017-08-10 15:21:42 -05:00
cpqphp_ctrl.c
cpqphp_nvram.c
cpqphp_nvram.h
cpqphp_pci.c
cpqphp_sysfs.c
ibmphp.h
ibmphp_core.c PCI: Constify hotplug pci_device_id structures 2017-08-10 15:21:42 -05:00
ibmphp_ebda.c PCI: Constify hotplug pci_device_id structures 2017-08-10 15:21:42 -05:00
ibmphp_hpc.c
ibmphp_pci.c
ibmphp_res.c
pci_hotplug_core.c PCI: hotplug: Don't leak pci_slot on registration failure 2018-08-24 13:09:22 +02:00
pciehp.h PCI: pciehp: Fix use-after-free on unplug 2018-08-24 13:09:22 +02:00
pciehp_core.c PCI: pciehp: Fix use-after-free on unplug 2018-08-24 13:09:22 +02:00
pciehp_ctrl.c
pciehp_hpc.c PCI: pciehp: Fix unprotected list iteration in IRQ handler 2018-08-24 13:09:23 +02:00
pciehp_pci.c
pcihp_skeleton.c
pnv_php.c PCI: Convert to using %pOF instead of full_name() 2017-08-24 11:24:59 -05:00
rpadlpar.h
rpadlpar_core.c PCI: Convert to using %pOF instead of full_name() 2017-08-24 11:24:59 -05:00
rpadlpar_sysfs.c PCI: Constify hotplug attribute_group structures 2017-08-10 15:21:41 -05:00
rpaphp.h
rpaphp_core.c PCI: Convert to using %pOF instead of full_name() 2017-08-24 11:24:59 -05:00
rpaphp_pci.c PCI: Convert to using %pOF instead of full_name() 2017-08-24 11:24:59 -05:00
rpaphp_slot.c PCI: Convert to using %pOF instead of full_name() 2017-08-24 11:24:59 -05:00
s390_pci_hpc.c
sgi_hotplug.c
shpchp.h
shpchp_core.c PCI: Constify hotplug pci_device_id structures 2017-08-10 15:21:42 -05:00
shpchp_ctrl.c
shpchp_hpc.c PCI: shpchp: Enable bridge bus mastering if MSI is enabled 2017-08-02 16:54:50 -05:00
shpchp_pci.c
shpchp_sysfs.c