aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
authorJames Hogan <james@albanarts.com>2010-10-11 17:59:58 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2010-10-16 19:57:50 -0400
commit2ac21c6bc4249ee6d922f18dbec7266377592c32 (patch)
tree6ef49d2222cf3591bcd427c5721411bdf95e1f12 /drivers/base/power
parentf71648d73c1650b8b4aceb3856bebbde6daa3b86 (diff)
PM: Lock PM device list mutex in show_dev_hash()
Lock the PM device list mutex using device_pm_lock() and device_pm_unlock() around the list iteration in show_dev_hash(). show_dev_hash() was reverse iterating dpm_list without first locking the mutex that the functions in drivers/base/power/main.c lock. I assume this was unintentional since there is no comment suggesting why the lock might not be necessary. Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/trace.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
index 0a1a2c4dbc6e..17e24e3f4422 100644
--- a/drivers/base/power/trace.c
+++ b/drivers/base/power/trace.c
@@ -188,8 +188,10 @@ static int show_file_hash(unsigned int value)
188static int show_dev_hash(unsigned int value) 188static int show_dev_hash(unsigned int value)
189{ 189{
190 int match = 0; 190 int match = 0;
191 struct list_head *entry = dpm_list.prev; 191 struct list_head *entry;
192 192
193 device_pm_lock();
194 entry = dpm_list.prev;
193 while (entry != &dpm_list) { 195 while (entry != &dpm_list) {
194 struct device * dev = to_device(entry); 196 struct device * dev = to_device(entry);
195 unsigned int hash = hash_string(DEVSEED, dev_name(dev), DEVHASH); 197 unsigned int hash = hash_string(DEVSEED, dev_name(dev), DEVHASH);
@@ -199,6 +201,7 @@ static int show_dev_hash(unsigned int value)
199 } 201 }
200 entry = entry->prev; 202 entry = entry->prev;
201 } 203 }
204 device_pm_unlock();
202 return match; 205 return match;
203} 206}
204 207