diff options
author | Axel Lin <axel.lin@ingics.com> | 2016-09-29 05:13:28 +0300 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-03-16 05:26:43 +0300 |
commit | 0d462d9e11bf889d7fc9df690b8e442252ec3394 (patch) | |
tree | 48df0ec0bdbba869d5f1ba91ebe50befb62ffeaf /drivers/devfreq | |
parent | d707044377aa915191f0f4916908f94a98251b8f (diff) | |
download | linux-0d462d9e11bf889d7fc9df690b8e442252ec3394.tar.xz |
PM / devfreq: Add proper locking around list_del()
commit 0f376c9cd86c23f37312d37748b233660ef9d9af upstream.
Use devfreq_list_lock around list_del() to prevent list corruption.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r-- | drivers/devfreq/devfreq.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index ba850eb2d275..b95b1ee3fcd6 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -507,17 +507,19 @@ struct devfreq *devfreq_add_device(struct device *dev, if (devfreq->governor) err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_START, NULL); - mutex_unlock(&devfreq_list_lock); if (err) { dev_err(dev, "%s: Unable to start governor for the device\n", __func__); goto err_init; } + mutex_unlock(&devfreq_list_lock); return devfreq; err_init: list_del(&devfreq->node); + mutex_unlock(&devfreq_list_lock); + device_unregister(&devfreq->dev); err_dev: kfree(devfreq); |