public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: fix struct autogroup memory leak
Date: Wed, 05 Jan 2011 11:30:45 +0100	[thread overview]
Message-ID: <1294223445.8369.14.camel@marge.simson.net> (raw)
In-Reply-To: <1294222874.2016.231.camel@laptop>

On Wed, 2011-01-05 at 11:21 +0100, Peter Zijlstra wrote:
> On Wed, 2011-01-05 at 11:11 +0100, Mike Galbraith wrote:
> 
> >  static inline void autogroup_free(struct task_group *tg)
> >  {
> > -	kfree(tg->autogroup);
> > +	if (tg->autogroup)
> > +		kfree(tg->autogroup);
> >  }
> 
> WARNING: kfree(NULL) is safe this check is probably not required
> #43: FILE: kernel/sched_autogroup.c:24:
> +       if (tg->autogroup)
> +               kfree(tg->autogroup);

Once upon a time, I knew that.

sched: fix struct autogroup memory leak

Add missing change to actually use autogroup_free().

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>

---
 kernel/sched.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -8382,6 +8382,7 @@ static void free_sched_group(struct task
 {
 	free_fair_sched_group(tg);
 	free_rt_sched_group(tg);
+	autogroup_free(tg);
 	kfree(tg);
 }
 



  reply	other threads:[~2011-01-05 10:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05 10:11 [PATCH] sched: fix struct autogroup memory leak Mike Galbraith
2011-01-05 10:21 ` Peter Zijlstra
2011-01-05 10:30   ` Mike Galbraith [this message]
2011-01-07 15:36 ` [tip:sched/urgent] sched: Fix " tip-bot for Mike Galbraith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294223445.8369.14.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox