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>
This commit is contained in:
Santosh Mardi 2017-05-09 11:24:04 +05:30
parent 3d82d66409
commit 28aab0311c

View file

@ -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: