From: Jules Maselbas <[email protected]>

This patch prevents the 'global_tunables_lock' mutex from being
unlocked before being locked.  This mutex is not locked if the
sugov_kthread_create() function fails.

Signed-off-by: Jules Maselbas <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Cc: Chris Redpath <[email protected]>
Cc: Dietmar Eggermann <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Patrick Bellasi <[email protected]>
Cc: Stephen Kyle <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
(cherry picked from commit 1b5d43cfb69759d8ef8d30469cea31d0c037aed5)
Signed-off-by: Arnd Bergmann <[email protected]>
---
 kernel/sched/cpufreq_schedutil.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 81eb7899c7c8..b314c9eaa71d 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -605,10 +605,9 @@ static int sugov_init(struct cpufreq_policy *policy)
 
 stop_kthread:
        sugov_kthread_stop(sg_policy);
-
-free_sg_policy:
        mutex_unlock(&global_tunables_lock);
 
+free_sg_policy:
        sugov_policy_free(sg_policy);
 
 disable_fast_switch:
-- 
2.20.0

Reply via email to