diff mbox

PM / devfreq: Add proper locking around list_del()

Message ID 1475054276-29528-1-git-send-email-axel.lin@ingics.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Axel Lin Sept. 28, 2016, 9:17 a.m. UTC
Use devfreq_list_lock around list_del() to prevent list corruption.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/devfreq/devfreq.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 478006b..70369b0 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -604,7 +604,10 @@  struct devfreq *devfreq_add_device(struct device *dev,
 	return devfreq;
 
 err_init:
+	mutex_lock(&devfreq_list_lock);
 	list_del(&devfreq->node);
+	mutex_unlock(&devfreq_list_lock);
+
 	device_unregister(&devfreq->dev);
 err_out:
 	return ERR_PTR(err);