public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: fix struct autogroup memory leak
@ 2011-01-05 10:11 Mike Galbraith
  2011-01-05 10:21 ` Peter Zijlstra
  2011-01-07 15:36 ` [tip:sched/urgent] sched: Fix " tip-bot for Mike Galbraith
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Galbraith @ 2011-01-05 10:11 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra

Seems I lost a change somewhere, leaking memory.

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 +
 kernel/sched_autogroup.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

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);
 }
 
Index: linux-2.6/kernel/sched_autogroup.c
===================================================================
--- linux-2.6.orig/kernel/sched_autogroup.c
+++ linux-2.6/kernel/sched_autogroup.c
@@ -20,7 +20,8 @@ static void autogroup_init(struct task_s
 
 static inline void autogroup_free(struct task_group *tg)
 {
-	kfree(tg->autogroup);
+	if (tg->autogroup)
+		kfree(tg->autogroup);
 }
 
 static inline void autogroup_destroy(struct kref *kref)



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

* Re: [PATCH] sched: fix struct autogroup memory leak
  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
  2011-01-07 15:36 ` [tip:sched/urgent] sched: Fix " tip-bot for Mike Galbraith
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2011-01-05 10:21 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: LKML

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

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

* Re: [PATCH] sched: fix struct autogroup memory leak
  2011-01-05 10:21 ` Peter Zijlstra
@ 2011-01-05 10:30   ` Mike Galbraith
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Galbraith @ 2011-01-05 10:30 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: LKML

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);
 }
 



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

* [tip:sched/urgent] sched: Fix struct autogroup memory leak
  2011-01-05 10:11 [PATCH] sched: fix struct autogroup memory leak Mike Galbraith
  2011-01-05 10:21 ` Peter Zijlstra
@ 2011-01-07 15:36 ` tip-bot for Mike Galbraith
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Mike Galbraith @ 2011-01-07 15:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, tglx, mingo

Commit-ID:  e9aa1dd19fe49b5aed3ca94aab87576e534d2a39
Gitweb:     http://git.kernel.org/tip/e9aa1dd19fe49b5aed3ca94aab87576e534d2a39
Author:     Mike Galbraith <efault@gmx.de>
AuthorDate: Wed, 5 Jan 2011 11:11:25 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 7 Jan 2011 15:54:37 +0100

sched: Fix struct autogroup memory leak

Seems I lost a change somewhere, leaking memory.

sched: fix struct autogroup memory leak

Add missing change to actually use autogroup_free().

Signed-off-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1294222285.8369.2.camel@marge.simson.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 54b58ec..a8478a2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8377,6 +8377,7 @@ static void free_sched_group(struct task_group *tg)
 {
 	free_fair_sched_group(tg);
 	free_rt_sched_group(tg);
+	autogroup_free(tg);
 	kfree(tg);
 }
 

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

end of thread, other threads:[~2011-01-07 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-01-07 15:36 ` [tip:sched/urgent] sched: Fix " tip-bot for Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox