From 28aab0311cfcd9b279f41f2f4da0085a660d5ed5 Mon Sep 17 00:00:00 2001 From: Santosh Mardi Date: Tue, 9 May 2017 11:24:04 +0530 Subject: 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 --- drivers/devfreq/governor_bw_hwmon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers') 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: -- cgit v1.2.3