diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-02 20:22:17 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-03 16:28:18 -0500 |
commit | f41b32613138ae05329a0f0e7170223b775d6b24 (patch) | |
tree | 9bc5cefef02934ca2a7fdb5308a58cf49909ea01 /drivers/pci | |
parent | 2d7c1b77dd59387070aab355532dd157f888325c (diff) |
ACPI / hotplug / PCI: Move PCI rescan-remove locking to hotplug_event()
Commit 9217a984671e (ACPI / hotplug / PCI: Use global PCI rescan-remove
locking) modified ACPIPHP to protect its PCI device removal and addition
code paths from races against sysfs-driven rescan and remove operations
with the help of PCI rescan-remove locking. However, it overlooked the
fact that hotplug_event_work() is not the only caller of hotplug_event()
which may also be called by dock_hotplug_event() and that code path
is missing the PCI rescan-remove locking. This means that, although
the PCI rescan-remove lock is held as appropriate during the handling
of events originating from handle_hotplug_event(), the ACPIPHP's
operations resulting from dock events may still suffer the race
conditions that commit 9217a984671e was supposed to eliminate.
To address that problem, move the PCI rescan-remove locking from
hotplug_event_work() to hotplug_event() so that it is used regardless
of the way that function is invoked.
Revamps: 9217a984671e (ACPI / hotplug / PCI: Use global PCI rescan-remove locking)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 6a4b4b734fbd..6e5bd79af810 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -852,6 +852,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) | |||
852 | 852 | ||
853 | mutex_unlock(&acpiphp_context_lock); | 853 | mutex_unlock(&acpiphp_context_lock); |
854 | 854 | ||
855 | pci_lock_rescan_remove(); | ||
855 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | 856 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); |
856 | 857 | ||
857 | switch (type) { | 858 | switch (type) { |
@@ -905,6 +906,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) | |||
905 | break; | 906 | break; |
906 | } | 907 | } |
907 | 908 | ||
909 | pci_unlock_rescan_remove(); | ||
908 | if (bridge) | 910 | if (bridge) |
909 | put_bridge(bridge); | 911 | put_bridge(bridge); |
910 | } | 912 | } |
@@ -915,11 +917,9 @@ static void hotplug_event_work(void *data, u32 type) | |||
915 | acpi_handle handle = context->handle; | 917 | acpi_handle handle = context->handle; |
916 | 918 | ||
917 | acpi_scan_lock_acquire(); | 919 | acpi_scan_lock_acquire(); |
918 | pci_lock_rescan_remove(); | ||
919 | 920 | ||
920 | hotplug_event(handle, type, context); | 921 | hotplug_event(handle, type, context); |
921 | 922 | ||
922 | pci_unlock_rescan_remove(); | ||
923 | acpi_scan_lock_release(); | 923 | acpi_scan_lock_release(); |
924 | acpi_evaluate_hotplug_ost(handle, type, ACPI_OST_SC_SUCCESS, NULL); | 924 | acpi_evaluate_hotplug_ost(handle, type, ACPI_OST_SC_SUCCESS, NULL); |
925 | put_bridge(context->func.parent); | 925 | put_bridge(context->func.parent); |