From 6ad827eb423eebe3792ad2a9bb55f90140b7d15d Mon Sep 17 00:00:00 2001 From: Jubeom Kim Date: Fri, 29 Nov 2013 16:37:28 +0900 Subject: [PATCH] cpuquiet: move back cpuquiet_lock Moved cpuquiet_lock to the back of cpuquiet_switch_governor(). cpuquiet_switch_governor() has to be protected by cpuquiet_lock. In the runnable cpuquiet_governor case, it can occur a kernel panic or BUG_ON because schedule_work() and INIT_WORK() can be performed at the same time. Bug 1410816 Change-Id: I6d3d69bd8896e5425a762cbc4a58343a319edf29 Signed-off-by: Jubeom Kim (cherry picked from commit 8502d0b7c057f96b7cd0495b49e37fc968d4bf8a) Reviewed-on: http://git-master/r/337335 Reviewed-by: Sai Gurrappadi Tested-by: Sai Gurrappadi Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Diwakar Tundlam --- drivers/cpuquiet/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpuquiet/sysfs.c b/drivers/cpuquiet/sysfs.c index c3ae097bd56d..3c1422680bbe 100644 --- a/drivers/cpuquiet/sysfs.c +++ b/drivers/cpuquiet/sysfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2012-2013 NVIDIA CORPORATION. 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 as published by @@ -70,10 +70,10 @@ static ssize_t store_current_governor(const char *buf, size_t count) mutex_lock(&cpuquiet_lock); gov = cpuquiet_find_governor(name); - mutex_unlock(&cpuquiet_lock); if (gov) ret = cpuquiet_switch_governor(gov); + mutex_unlock(&cpuquiet_lock); if (ret) return ret; -- 2.34.1