login
Header Space

 
 

[PATCH 5/8] PM: fix new mutex-locking bug in the PM core

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: Alan Stern <stern@...>, Greg Kroah-Hartman <gregkh@...>
Date: Tuesday, March 4, 2008 - 7:18 pm

From: Alan Stern <stern@rowland.harvard.edu>

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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index b0c16f6..d887d5c 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -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);
 	}
-- 
1.5.4.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 8/8] debugfs: fix sparse warnings, Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
[PATCH 7/8] Driver core: Fix cleanup when failing device_add..., Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
[PATCH 6/8] driver core: Remove dpm_sysfs_remove() from erro..., Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
[PATCH 5/8] PM: fix new mutex-locking bug in the PM core, Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
[PATCH 4/8] PM: Do not acquire device semaphores upfront dur..., Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
[PATCH 3/8] kobject: properly initialize ksets, Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
[PATCH 2/8] sysfs: CONFIG_SYSFS_DEPRECATED fix, Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
[PATCH 1/8] driver core: fix up Kconfig text for CONFIG_SYSF..., Greg Kroah-Hartman, (Tue Mar 4, 7:18 pm)
speck-geostationary