linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sched/core: Fix &rd->rto_mask memory leak
@ 2017-01-24 21:11 Mathieu Poirier
  2017-01-24 21:11 ` [PATCH 2/2] sched/core: Fix &rd->cpudl " Mathieu Poirier
  2017-01-30 11:56 ` [tip:sched/core] sched/core: Fix &rd->rto_mask " tip-bot for Mathieu Poirier
  0 siblings, 2 replies; 4+ messages in thread
From: Mathieu Poirier @ 2017-01-24 21:11 UTC (permalink / raw)
  To: mingo, peterz; +Cc: linux-kernel

If function cpudl_init() fails the memory allocated for &rd->rto_mask
needs to be freed, something this patch is addressing.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c56fb57f2991..5c01ac0f915a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5881,7 +5881,7 @@ static int init_rootdomain(struct root_domain *rd)
 
 	init_dl_bw(&rd->dl_bw);
 	if (cpudl_init(&rd->cpudl) != 0)
-		goto free_dlo_mask;
+		goto free_rto_mask;
 
 	if (cpupri_init(&rd->cpupri) != 0)
 		goto free_rto_mask;
-- 
2.7.4

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

* [PATCH 2/2] sched/core: Fix &rd->cpudl memory leak
  2017-01-24 21:11 [PATCH 1/2] sched/core: Fix &rd->rto_mask memory leak Mathieu Poirier
@ 2017-01-24 21:11 ` Mathieu Poirier
  2017-01-30 11:56   ` [tip:sched/core] " tip-bot for Mathieu Poirier
  2017-01-30 11:56 ` [tip:sched/core] sched/core: Fix &rd->rto_mask " tip-bot for Mathieu Poirier
  1 sibling, 1 reply; 4+ messages in thread
From: Mathieu Poirier @ 2017-01-24 21:11 UTC (permalink / raw)
  To: mingo, peterz; +Cc: linux-kernel

While in the process of initialising a root domain, if function
cpupri_init() fails the memory allocated in cpudl_init() is not
reclaimed.

Adding a new goto target to cleanup the previous initialistion of
the root_domain's dl_bw structure reclaims said memory.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 kernel/sched/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5c01ac0f915a..f06ce70757a7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5884,9 +5884,11 @@ static int init_rootdomain(struct root_domain *rd)
 		goto free_rto_mask;
 
 	if (cpupri_init(&rd->cpupri) != 0)
-		goto free_rto_mask;
+		goto free_cpudl;
 	return 0;
 
+free_cpudl:
+	cpudl_cleanup(&rd->cpudl);
 free_rto_mask:
 	free_cpumask_var(rd->rto_mask);
 free_dlo_mask:
-- 
2.7.4

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

* [tip:sched/core] sched/core: Fix &rd->rto_mask memory leak
  2017-01-24 21:11 [PATCH 1/2] sched/core: Fix &rd->rto_mask memory leak Mathieu Poirier
  2017-01-24 21:11 ` [PATCH 2/2] sched/core: Fix &rd->cpudl " Mathieu Poirier
@ 2017-01-30 11:56 ` tip-bot for Mathieu Poirier
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Mathieu Poirier @ 2017-01-30 11:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, tglx, hpa, torvalds, mathieu.poirier, linux-kernel,
	mingo, efault

Commit-ID:  92c99ac829931abba33107e09358447c8ad6bd32
Gitweb:     http://git.kernel.org/tip/92c99ac829931abba33107e09358447c8ad6bd32
Author:     Mathieu Poirier <mathieu.poirier@linaro.org>
AuthorDate: Tue, 24 Jan 2017 14:11:34 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 30 Jan 2017 11:46:36 +0100

sched/core: Fix &rd->rto_mask memory leak

If function cpudl_init() fails the memory allocated for &rd->rto_mask
needs to be freed, something this patch is addressing.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1485292295-21298-1-git-send-email-mathieu.poirier@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3b248b0..17d1df6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5976,7 +5976,7 @@ static int init_rootdomain(struct root_domain *rd)
 
 	init_dl_bw(&rd->dl_bw);
 	if (cpudl_init(&rd->cpudl) != 0)
-		goto free_dlo_mask;
+		goto free_rto_mask;
 
 	if (cpupri_init(&rd->cpupri) != 0)
 		goto free_rto_mask;

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

* [tip:sched/core] sched/core: Fix &rd->cpudl memory leak
  2017-01-24 21:11 ` [PATCH 2/2] sched/core: Fix &rd->cpudl " Mathieu Poirier
@ 2017-01-30 11:56   ` tip-bot for Mathieu Poirier
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Mathieu Poirier @ 2017-01-30 11:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, tglx, mingo, mathieu.poirier, torvalds, linux-kernel,
	efault, peterz

Commit-ID:  4b12db939166042eb78e592bdf94ef113c14e379
Gitweb:     http://git.kernel.org/tip/4b12db939166042eb78e592bdf94ef113c14e379
Author:     Mathieu Poirier <mathieu.poirier@linaro.org>
AuthorDate: Tue, 24 Jan 2017 14:11:35 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 30 Jan 2017 11:46:37 +0100

sched/core: Fix &rd->cpudl memory leak

While in the process of initialising a root domain, if function
cpupri_init() fails the memory allocated in cpudl_init() is not
reclaimed.

Adding a new goto target to cleanup the previous initialistion of
the root_domain's dl_bw structure reclaims said memory.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1485292295-21298-2-git-send-email-mathieu.poirier@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 17d1df6..d01f9d0 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5979,9 +5979,11 @@ static int init_rootdomain(struct root_domain *rd)
 		goto free_rto_mask;
 
 	if (cpupri_init(&rd->cpupri) != 0)
-		goto free_rto_mask;
+		goto free_cpudl;
 	return 0;
 
+free_cpudl:
+	cpudl_cleanup(&rd->cpudl);
 free_rto_mask:
 	free_cpumask_var(rd->rto_mask);
 free_dlo_mask:

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

end of thread, other threads:[~2017-01-30 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 21:11 [PATCH 1/2] sched/core: Fix &rd->rto_mask memory leak Mathieu Poirier
2017-01-24 21:11 ` [PATCH 2/2] sched/core: Fix &rd->cpudl " Mathieu Poirier
2017-01-30 11:56   ` [tip:sched/core] " tip-bot for Mathieu Poirier
2017-01-30 11:56 ` [tip:sched/core] sched/core: Fix &rd->rto_mask " tip-bot for Mathieu Poirier

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