From: Rafael J. Wysocki Date: Mon, 10 Feb 2014 12:36:26 +0000 (+0100) Subject: ACPI / hotplug / PCI: Execute _EJ0 under the ACPI scan lock X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=21369c77477a7f937174833c8094154f0f995710;p=linux-beck.git ACPI / hotplug / PCI: Execute _EJ0 under the ACPI scan lock Since acpi_device_hotplug() assumes that ACPI handles of device objects passed to it will not become invalid while acpi_scan_lock is being held, make acpiphp_disable_slot() acquire acpi_scan_lock, because it generally causes _EJ0 to be executed for one of the devices in the slot and that may cause its ACPI handle to become invalid. Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 11a6117fb358..fa8fe7441952 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -1007,9 +1007,15 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) { int ret; + /* + * Acquire acpi_scan_lock to ensure that the execution of _EJ0 in + * acpiphp_disable_and_eject_slot() will be synchronized properly. + */ + acpi_scan_lock_acquire(); pci_lock_rescan_remove(); ret = acpiphp_disable_and_eject_slot(slot); pci_unlock_rescan_remove(); + acpi_scan_lock_release(); return ret; }