summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSantosh Mardi <gsantosh@codeaurora.org>2017-05-09 11:24:04 +0530
committerSantosh Mardi <gsantosh@codeaurora.org>2017-05-12 10:22:31 +0530
commit28aab0311cfcd9b279f41f2f4da0085a660d5ed5 (patch)
tree37e06f485ca5df87d6b275fce40c73649aa4f619 /drivers
parent3d82d66409abb91539bcb9d1f343fcb9d583f2b4 (diff)
PM/devfreq: bw_hwmon: add mutex lock in polling interval case
Protect polling interval update event in the governor with mutex lock. This will avoid parallel execution of update interval event on different cores, resulting in memory poison overwritten. CRs-Fixed: 2035633 Change-Id: Ib919d9774317bc01e3cf581c169c5d18555f484f Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/devfreq/governor_bw_hwmon.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/devfreq/governor_bw_hwmon.c b/drivers/devfreq/governor_bw_hwmon.c
index b997e79e3d73..972de02ca549 100644
--- a/drivers/devfreq/governor_bw_hwmon.c
+++ b/drivers/devfreq/governor_bw_hwmon.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -86,6 +86,8 @@ static DEFINE_SPINLOCK(irq_lock);
static LIST_HEAD(hwmon_list);
static DEFINE_MUTEX(list_lock);
+static DEFINE_MUTEX(sync_lock);
+
static int use_cnt;
static DEFINE_MUTEX(state_lock);
@@ -846,6 +848,7 @@ static int devfreq_bw_hwmon_ev_handler(struct devfreq *df,
break;
case DEVFREQ_GOV_INTERVAL:
+ mutex_lock(&sync_lock);
sample_ms = *(unsigned int *)data;
sample_ms = max(MIN_MS, sample_ms);
sample_ms = min(MAX_MS, sample_ms);
@@ -865,6 +868,7 @@ static int devfreq_bw_hwmon_ev_handler(struct devfreq *df,
"Unable to resume HW monitor (%d)\n", ret);
return ret;
}
+ mutex_unlock(&sync_lock);
break;
case DEVFREQ_GOV_SUSPEND: