linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] sched/cpufreq: Fix kobject memleak
@ 2019-04-30  0:17 Tobin C. Harding
  2019-04-30  4:24 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Tobin C. Harding @ 2019-04-30  0:17 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().

Signed-off-by: Tobin C. Harding <tobin@kernel.org>
---

Resend with SOB tag.

 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] 3+ messages in thread

* Re: [PATCH RESEND] sched/cpufreq: Fix kobject memleak
  2019-04-30  0:17 [PATCH RESEND] sched/cpufreq: Fix kobject memleak Tobin C. Harding
@ 2019-04-30  4:24 ` Ingo Molnar
  2019-04-30  5:15   ` Tobin C. Harding
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2019-04-30  4:24 UTC (permalink / raw)
  To: Tobin C. Harding
  Cc: Ingo Molnar, Peter Zijlstra, Greg Kroah-Hartman, linux-kernel


* Tobin C. Harding <tobin@kernel.org> wrote:

> 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().
> 
> Signed-off-by: Tobin C. Harding <tobin@kernel.org>
> ---
> 
> Resend with SOB tag.

Please ignore my previous mail :-)

Thanks,

	Ingo

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

* Re: [PATCH RESEND] sched/cpufreq: Fix kobject memleak
  2019-04-30  4:24 ` Ingo Molnar
@ 2019-04-30  5:15   ` Tobin C. Harding
  0 siblings, 0 replies; 3+ messages in thread
From: Tobin C. Harding @ 2019-04-30  5:15 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Tobin C. Harding, Ingo Molnar, Peter Zijlstra,
	Greg Kroah-Hartman, linux-kernel

On Tue, Apr 30, 2019 at 06:24:43AM +0200, Ingo Molnar wrote:
> 
> * Tobin C. Harding <tobin@kernel.org> wrote:
> 
> > 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().
> > 
> > Signed-off-by: Tobin C. Harding <tobin@kernel.org>
> > ---
> > 
> > Resend with SOB tag.
> 
> Please ignore my previous mail :-)

Cheers Ingo, caught myself not checkpatching :(

thanks,
Tobin.


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30  0:17 [PATCH RESEND] sched/cpufreq: Fix kobject memleak Tobin C. Harding
2019-04-30  4:24 ` Ingo Molnar
2019-04-30  5:15   ` Tobin C. Harding

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).