• Lukas Wunner's avatar
    PCI: pciehp: Fix unprotected list iteration in IRQ handler · b5b7417e
    Lukas Wunner authored
    commit 1204e35bedf4e5015cda559ed8c84789a6dae24e upstream.
    
    Commit b440bde7 ("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: b440bde7 ("PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device")
    Signed-off-by: 's avatarLukas Wunner <lukas@wunner.de>
    Signed-off-by: 's avatarBjorn Helgaas <bhelgaas@google.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    b5b7417e
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
acpi_pcihp.c Loading commit data...
acpiphp.h Loading commit data...
acpiphp_core.c Loading commit data...
acpiphp_glue.c Loading commit data...
acpiphp_ibm.c Loading commit data...
cpci_hotplug.h Loading commit data...
cpci_hotplug_core.c Loading commit data...
cpci_hotplug_pci.c Loading commit data...
cpcihp_generic.c Loading commit data...
cpcihp_zt5550.c Loading commit data...
cpcihp_zt5550.h Loading commit data...
cpqphp.h Loading commit data...
cpqphp_core.c Loading commit data...
cpqphp_ctrl.c Loading commit data...
cpqphp_nvram.c Loading commit data...
cpqphp_nvram.h Loading commit data...
cpqphp_pci.c Loading commit data...
cpqphp_sysfs.c Loading commit data...
ibmphp.h Loading commit data...
ibmphp_core.c Loading commit data...
ibmphp_ebda.c Loading commit data...
ibmphp_hpc.c Loading commit data...
ibmphp_pci.c Loading commit data...
ibmphp_res.c Loading commit data...
pci_hotplug_core.c Loading commit data...
pciehp.h Loading commit data...
pciehp_core.c Loading commit data...
pciehp_ctrl.c Loading commit data...
pciehp_hpc.c Loading commit data...
pciehp_pci.c Loading commit data...
pcihp_skeleton.c Loading commit data...
pnv_php.c Loading commit data...
rpadlpar.h Loading commit data...
rpadlpar_core.c Loading commit data...
rpadlpar_sysfs.c Loading commit data...
rpaphp.h Loading commit data...
rpaphp_core.c Loading commit data...
rpaphp_pci.c Loading commit data...
rpaphp_slot.c Loading commit data...
s390_pci_hpc.c Loading commit data...
sgi_hotplug.c Loading commit data...
shpchp.h Loading commit data...
shpchp_core.c Loading commit data...
shpchp_ctrl.c Loading commit data...
shpchp_hpc.c Loading commit data...
shpchp_pci.c Loading commit data...
shpchp_sysfs.c Loading commit data...