aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-15 18:38:30 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-19 17:56:30 -0400
commit8112006f41fd76ddf4988f8ddd904563db85613c (patch)
treecd47e67bbac7c000696be79971326f8bf4bd1706 /drivers/acpi
parent204ebc0aa30a7115f300cac39fbb7eeb66524881 (diff)
ACPI / dock: Take ACPI scan lock in write_undock()
Since commit 3757b94 (ACPI / hotplug: Fix concurrency issues and memory leaks) acpi_bus_scan() and acpi_bus_trim() must always be called under acpi_scan_lock, but currently the following scenario violating that requirement is possible: write_undock() handle_eject_request() hotplug_dock_devices() dock_remove_acpi_device() acpi_bus_trim() Fix that by making write_undock() acquire acpi_scan_lock before calling handle_eject_request() as appropriate (begin_undock() is under the lock too in analogy with acpi_dock_deferred_cb()). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: 3.9+ <stable@vger.kernel.org> Acked-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/dock.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 4fdea381ef21..ec117c6c996c 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -868,8 +868,10 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr,
868 if (!count) 868 if (!count)
869 return -EINVAL; 869 return -EINVAL;
870 870
871 acpi_scan_lock_acquire();
871 begin_undock(dock_station); 872 begin_undock(dock_station);
872 ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); 873 ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST);
874 acpi_scan_lock_release();
873 return ret ? ret: count; 875 return ret ? ret: count;
874} 876}
875static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock); 877static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock);