* [PATCH] ACPI / PM: Walk physical_node_list under physical_node_lock
@ 2013-08-05 14:10 Rafael J. Wysocki
0 siblings, 0 replies; only message in thread
From: Rafael J. Wysocki @ 2013-08-05 14:10 UTC (permalink / raw)
To: ACPI Devel Maling List; +Cc: LKML, Linux PM list
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The list of physical devices corresponding to an ACPI device
object is walked by acpi_system_wakeup_device_seq_show() and
physical_device_enable_wakeup() without taking that object's
physical_node_lock mutex. Since each of those functions may be
run at any time as a result of a user space action, the lack of
appropriate locking in them may lead to a kernel crash if that
happens during device hot-add or hot-remove involving the device
object in question.
Fix the issue by modifying acpi_system_wakeup_device_seq_show() and
physical_device_enable_wakeup() to use physical_node_lock as
appropriate.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: All <stable@vger.kernel.org>
---
This is urgent stuff, so if anyone has any objections against this or sees
any problems with it, please let me know immediately.
Thanks,
Rafael
---
drivers/acpi/proc.c | 8 ++++++++
1 file changed, 8 insertions(+)
Index: linux-pm/drivers/acpi/proc.c
===================================================================
--- linux-pm.orig/drivers/acpi/proc.c
+++ linux-pm/drivers/acpi/proc.c
@@ -311,6 +311,8 @@ acpi_system_wakeup_device_seq_show(struc
dev->pnp.bus_id,
(u32) dev->wakeup.sleep_state);
+ mutex_lock(&dev->physical_node_lock);
+
if (!dev->physical_node_count) {
seq_printf(seq, "%c%-8s\n",
dev->wakeup.flags.run_wake ? '*' : ' ',
@@ -338,6 +340,8 @@ acpi_system_wakeup_device_seq_show(struc
put_device(ldev);
}
}
+
+ mutex_unlock(&dev->physical_node_lock);
}
mutex_unlock(&acpi_device_lock);
return 0;
@@ -347,12 +351,16 @@ static void physical_device_enable_wakeu
{
struct acpi_device_physical_node *entry;
+ mutex_lock(&adev->physical_node_lock);
+
list_for_each_entry(entry,
&adev->physical_node_list, node)
if (entry->dev && device_can_wakeup(entry->dev)) {
bool enable = !device_may_wakeup(entry->dev);
device_set_wakeup_enable(entry->dev, enable);
}
+
+ mutex_unlock(&adev->physical_node_lock);
}
static ssize_t
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-05 13:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05 14:10 [PATCH] ACPI / PM: Walk physical_node_list under physical_node_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
all inboxes | Powered by JetHome®