]> err.no Git - linux-2.6/commitdiff
PM: fix new mutex-locking bug in the PM core
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 29 Feb 2008 16:50:22 +0000 (11:50 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 4 Mar 2008 22:47:05 +0000 (14:47 -0800)
This patch (as1041) fixes a bug introduced by the
acquire-all-device-semaphores reversion.  The error pathway of
dpm_suspend() fails to reacquire a mutex it should be holding.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/power/main.c

index b0c16f6fc1864654a53e6da1be60b19a7ea6a15d..d887d5cb5bef74496f323a84d94b691ab24a2550 100644 (file)
@@ -428,6 +428,7 @@ static int dpm_suspend(pm_message_t state)
 
                mutex_unlock(&dpm_list_mtx);
                error = suspend_device(dev, state);
+               mutex_lock(&dpm_list_mtx);
                if (error) {
                        printk(KERN_ERR "Could not suspend device %s: "
                                        "error %d%s\n",
@@ -438,7 +439,6 @@ static int dpm_suspend(pm_message_t state)
                                        ""));
                        break;
                }
-               mutex_lock(&dpm_list_mtx);
                if (!list_empty(&dev->power.entry))
                        list_move(&dev->power.entry, &dpm_off);
        }