aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMichael Richardson <mcr@sandelman.ottawa.on.ca>2006-01-09 04:04:51 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-13 14:26:12 -0500
commit9c08a938ce5a3e1c9d5f764dc6ae844cb1af76ff (patch)
tree9bd0a984b2e5466454e2633783786a516fe14484 /drivers/base
parent2d7b5a70e01ff8b1b054d8313362e454e3057c5a (diff)
[PATCH] device_shutdown can loop if the driver frees itself
This patch changes device_shutdown() to use the newly introduced safe reverse list traversal. We experienced loops on system reboot if we had removed and re-inserted our device from the device list. We noticed this problem on PPC405. Our PCI IDE device comes and goes a lot. Our hypothesis was that there was a loop caused by the driver->shutdown freeing memory. It is possible that we do something wrong as well, but being unable to reboot is kind of nasty. Signed-off-by: Michael Richardson <mcr@marajade.sandelman.ca> Cc: Patrick Mochel <mochel@digitalimplant.org> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/shutdown.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index a47bb74da72b..c2475f3134ea 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -35,10 +35,10 @@ extern int sysdev_shutdown(void);
35 */ 35 */
36void device_shutdown(void) 36void device_shutdown(void)
37{ 37{
38 struct device * dev; 38 struct device * dev, *devn;
39 39
40 down_write(&devices_subsys.rwsem); 40 down_write(&devices_subsys.rwsem);
41 list_for_each_entry_reverse(dev, &devices_subsys.kset.list, 41 list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list,
42 kobj.entry) { 42 kobj.entry) {
43 if (dev->bus && dev->bus->shutdown) { 43 if (dev->bus && dev->bus->shutdown) {
44 dev_dbg(dev, "shutdown\n"); 44 dev_dbg(dev, "shutdown\n");