All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/cpufreq: Fix kobject memleak
@ 2019-04-30  0:11 Tobin C. Harding
  2019-04-30  4:22 ` Ingo Molnar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tobin C. Harding @ 2019-04-30  0:11 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Tobin C. Harding, Greg Kroah-Hartman, linux-kernel

Currently error return from kobject_init_and_add() is not followed by a
call to kobject_put().  This means there is a memory leak.

Add call to kobject_put() in error path of kobject_init_and_add().
---
 kernel/sched/cpufreq_schedutil.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 5c41ea367422..3638d2377e3c 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -771,6 +771,7 @@ static int sugov_init(struct cpufreq_policy *policy)
 	return 0;
 
 fail:
+	kobject_put(&tunables->attr_set.kobj);
 	policy->governor_data = NULL;
 	sugov_tunables_free(tunables);
 
-- 
2.21.0


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

end of thread, other threads:[~2019-04-30  6:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30  0:11 [PATCH] sched/cpufreq: Fix kobject memleak Tobin C. Harding
2019-04-30  4:22 ` Ingo Molnar
2019-04-30  5:52 ` [tip:sched/urgent] " tip-bot for Tobin C. Harding
2019-04-30  5:56   ` Viresh Kumar
2019-04-30  6:27     ` Tobin C. Harding
2019-04-30  6:01 ` tip-bot for Tobin C. Harding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.