linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: schedutil: Prevent unnecessary mutex unlock
@ 2018-03-29 14:43 Jules Maselbas
  2018-03-31 18:52 ` [tip:sched/urgent] sched/cpufreq/schedutil: Fix error path " tip-bot for Jules Maselbas
  0 siblings, 1 reply; 2+ messages in thread
From: Jules Maselbas @ 2018-03-29 14:43 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Peter Zijlstra, Chris Redpath, Patrick Bellasi,
	Dietmar Eggermann, Stephen Kyle, linux-kernel, Jules Maselbas,
	nd

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

Signed-off-by: Jules Maselbas <jules.maselbas@arm.com>
---
 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 7936f548e071..617c6741c525 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -625,10 +625,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.16.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:sched/urgent] sched/cpufreq/schedutil: Fix error path mutex unlock
  2018-03-29 14:43 [PATCH] cpufreq: schedutil: Prevent unnecessary mutex unlock Jules Maselbas
@ 2018-03-31 18:52 ` tip-bot for Jules Maselbas
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Jules Maselbas @ 2018-03-31 18:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, dietmar.eggemann, linux-kernel, stephen.kyle,
	jules.maselbas, hpa, patrick.bellasi, torvalds, chris.redpath,
	mingo, efault, tglx

Commit-ID:  1b5d43cfb69759d8ef8d30469cea31d0c037aed5
Gitweb:     https://git.kernel.org/tip/1b5d43cfb69759d8ef8d30469cea31d0c037aed5
Author:     Jules Maselbas <jules.maselbas@arm.com>
AuthorDate: Thu, 29 Mar 2018 15:43:01 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 31 Mar 2018 20:42:38 +0200

sched/cpufreq/schedutil: Fix error path mutex unlock

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 <jules.maselbas@arm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Chris Redpath <chris.redpath@arm.com>
Cc: Dietmar Eggermann <dietmar.eggemann@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Patrick Bellasi <patrick.bellasi@arm.com>
Cc: Stephen Kyle <stephen.kyle@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Cc: nd@arm.com
Link: http://lkml.kernel.org/r/20180329144301.38419-1-jules.maselbas@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 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 7936f548e071..617c6741c525 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -625,10 +625,9 @@ fail:
 
 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:

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-31 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29 14:43 [PATCH] cpufreq: schedutil: Prevent unnecessary mutex unlock Jules Maselbas
2018-03-31 18:52 ` [tip:sched/urgent] sched/cpufreq/schedutil: Fix error path " tip-bot for Jules Maselbas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).