linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI / hotplug / PCI: Execute _EJ0 under the ACPI scan lock
@ 2014-02-08 15:22 Rafael J. Wysocki
  0 siblings, 0 replies; only message in thread
From: Rafael J. Wysocki @ 2014-02-08 15:22 UTC (permalink / raw)
  To: ACPI Devel Maling List; +Cc: Linux PCI, Linux Kernel Mailing List

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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 <rafael.j.wysocki@intel.com>
---

Hi All,

This change is not necessary in 3.14-rc (it wouldn't hurt, though), but it
closes a (mostly theoretical) race on top of the changes I've queued up for
3.15 in linux-next.

Thanks,
Rafael

---
 drivers/pci/hotplug/acpiphp_glue.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-pm/drivers/pci/hotplug/acpiphp_glue.c
===================================================================
--- linux-pm.orig/drivers/pci/hotplug/acpiphp_glue.c
+++ linux-pm/drivers/pci/hotplug/acpiphp_glue.c
@@ -1007,9 +1007,15 @@ int acpiphp_disable_slot(struct acpiphp_
 {
 	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;
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-08 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-08 15:22 [PATCH] ACPI / hotplug / PCI: Execute _EJ0 under the ACPI scan lock Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).