public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 2/2] cpuset: alloc nodemask_t at heap not stack - fix
@ 2010-03-15  5:20 Miao Xie
  0 siblings, 0 replies; only message in thread
From: Miao Xie @ 2010-03-15  5:20 UTC (permalink / raw)
  To: Andrew Morton, David Rientjes, Paul Menage; +Cc: Linux-Kernel

Changes from V1 to V2:
- remove unnecessary checking.

fix memory leak

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
Against the following patch in mmotm-2010-03-11-13-13:
cpuset-alloc-nodemask_t-at-heap-not-stack.patch
---
 kernel/cpuset.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index f36e577..02b4545 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1401,7 +1401,7 @@ static void cpuset_attach(struct cgroup_subsys *ss, struct cgroup *cont,
 	NODEMASK_ALLOC(nodemask_t, to, GFP_KERNEL);
 
 	if (from == NULL || to == NULL)
-		return;
+		goto alloc_fail;
 
 	if (cs == &top_cpuset) {
 		cpumask_copy(cpus_attach, cpu_possible_mask);
@@ -1432,6 +1432,7 @@ static void cpuset_attach(struct cgroup_subsys *ss, struct cgroup *cont,
 		mmput(mm);
 	}
 
+alloc_fail:
 	NODEMASK_FREE(from);
 	NODEMASK_FREE(to);
 }
-- 
1.6.5.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-15  5:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-15  5:20 [PATCH V2 2/2] cpuset: alloc nodemask_t at heap not stack - fix Miao Xie

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