aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/proc.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2009-04-06 22:24:29 -0400
committerLen Brown <len.brown@intel.com>2009-04-07 00:02:40 -0400
commit9090589d87506c578ea1523ffd7ae7fd9424fb28 (patch)
tree215163d13dbfa514a4121594cd4c6e27fde9b911 /drivers/acpi/proc.c
parentd508afb437daee7cf07da085b635c44a4ebf9b38 (diff)
ACPI: convert acpi_device_lock spinlock to mutex
Convert acpi_device_lock to a mutex to avoid a potential race upon access to /proc/acpi/wakeup Delete the lock entirely in wakeup.c since it is not necessary (and can not sleep) Found-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/proc.c')
-rw-r--r--drivers/acpi/proc.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 05dfdc96802e..d0d550d22a6d 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -343,9 +343,6 @@ acpi_system_write_alarm(struct file *file,
343} 343}
344#endif /* HAVE_ACPI_LEGACY_ALARM */ 344#endif /* HAVE_ACPI_LEGACY_ALARM */
345 345
346extern struct list_head acpi_wakeup_device_list;
347extern spinlock_t acpi_device_lock;
348
349static int 346static int
350acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) 347acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
351{ 348{
@@ -353,7 +350,7 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
353 350
354 seq_printf(seq, "Device\tS-state\t Status Sysfs node\n"); 351 seq_printf(seq, "Device\tS-state\t Status Sysfs node\n");
355 352
356 spin_lock(&acpi_device_lock); 353 mutex_lock(&acpi_device_lock);
357 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 354 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
358 struct acpi_device *dev = 355 struct acpi_device *dev =
359 container_of(node, struct acpi_device, wakeup_list); 356 container_of(node, struct acpi_device, wakeup_list);
@@ -361,7 +358,6 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
361 358
362 if (!dev->wakeup.flags.valid) 359 if (!dev->wakeup.flags.valid)
363 continue; 360 continue;
364 spin_unlock(&acpi_device_lock);
365 361
366 ldev = acpi_get_physical_device(dev->handle); 362 ldev = acpi_get_physical_device(dev->handle);
367 seq_printf(seq, "%s\t S%d\t%c%-8s ", 363 seq_printf(seq, "%s\t S%d\t%c%-8s ",
@@ -376,9 +372,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
376 seq_printf(seq, "\n"); 372 seq_printf(seq, "\n");
377 put_device(ldev); 373 put_device(ldev);
378 374
379 spin_lock(&acpi_device_lock);
380 } 375 }
381 spin_unlock(&acpi_device_lock); 376 mutex_unlock(&acpi_device_lock);
382 return 0; 377 return 0;
383} 378}
384 379
@@ -409,7 +404,7 @@ acpi_system_write_wakeup_device(struct file *file,
409 strbuf[len] = '\0'; 404 strbuf[len] = '\0';
410 sscanf(strbuf, "%s", str); 405 sscanf(strbuf, "%s", str);
411 406
412 spin_lock(&acpi_device_lock); 407 mutex_lock(&acpi_device_lock);
413 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 408 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
414 struct acpi_device *dev = 409 struct acpi_device *dev =
415 container_of(node, struct acpi_device, wakeup_list); 410 container_of(node, struct acpi_device, wakeup_list);
@@ -446,7 +441,7 @@ acpi_system_write_wakeup_device(struct file *file,
446 } 441 }
447 } 442 }
448 } 443 }
449 spin_unlock(&acpi_device_lock); 444 mutex_unlock(&acpi_device_lock);
450 return count; 445 return count;
451} 446}
452 447