Commit 12d00f6a authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

cpu hotplug: slab: fix memory leak in cpu hotplug error path

This patch fixes memory leak in error path.

In reality, we don't need to call cpuup_canceled(cpu) for now.  But upcoming
cpu hotplug error handling change needs this.

Cc: Christoph Lameter <clameter@sgi.com>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Acked-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fbf1e473
...@@ -1282,13 +1282,18 @@ static int __cpuinit cpuup_prepare(long cpu) ...@@ -1282,13 +1282,18 @@ static int __cpuinit cpuup_prepare(long cpu)
shared = alloc_arraycache(node, shared = alloc_arraycache(node,
cachep->shared * cachep->batchcount, cachep->shared * cachep->batchcount,
0xbaadf00d); 0xbaadf00d);
if (!shared) if (!shared) {
kfree(nc);
goto bad; goto bad;
}
} }
if (use_alien_caches) { if (use_alien_caches) {
alien = alloc_alien_cache(node, cachep->limit); alien = alloc_alien_cache(node, cachep->limit);
if (!alien) if (!alien) {
kfree(shared);
kfree(nc);
goto bad; goto bad;
}
} }
cachep->array[cpu] = nc; cachep->array[cpu] = nc;
l3 = cachep->nodelists[node]; l3 = cachep->nodelists[node];
...@@ -1315,6 +1320,7 @@ static int __cpuinit cpuup_prepare(long cpu) ...@@ -1315,6 +1320,7 @@ static int __cpuinit cpuup_prepare(long cpu)
} }
return 0; return 0;
bad: bad:
cpuup_canceled(cpu);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment