[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1489146382.49083954@decadent.org.uk>
Date: Fri, 10 Mar 2017 11:46:22 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Axel Lin" <axel.lin@...ics.com>,
"MyungJoo Ham" <myungjoo.ham@...sung.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Subject: [PATCH 3.16 145/370] PM / devfreq: Add proper locking around
list_del()
3.16.42-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <axel.lin@...ics.com>
commit 0f376c9cd86c23f37312d37748b233660ef9d9af upstream.
Use devfreq_list_lock around list_del() to prevent list corruption.
Signed-off-by: Axel Lin <axel.lin@...ics.com>
Acked-by: MyungJoo Ham <myungjoo.ham@...sung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/devfreq/devfreq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -507,17 +507,19 @@ struct devfreq *devfreq_add_device(struc
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);
Powered by blists - more mailing lists