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 <[email protected]>
Cc: Gautham R Shenoy <[email protected]>
Cc: Pekka Enberg <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>
---
mm/slab.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: 2.6-git/mm/slab.c
===================================================================
--- 2.6-git.orig/mm/slab.c
+++ 2.6-git/mm/slab.c
@@ -1282,13 +1282,18 @@ static int __cpuinit cpuup_prepare(long
shared = alloc_arraycache(node,
cachep->shared * cachep->batchcount,
0xbaadf00d);
- if (!shared)
+ if (!shared) {
+ kfree(nc);
goto bad;
+ }
}
if (use_alien_caches) {
alien = alloc_alien_cache(node, cachep->limit);
- if (!alien)
+ if (!alien) {
+ kfree(shared);
+ kfree(nc);
goto bad;
+ }
}
cachep->array[cpu] = nc;
l3 = cachep->nodelists[node];
@@ -1315,6 +1320,7 @@ static int __cpuinit cpuup_prepare(long
}
return 0;
bad:
+ cpuup_canceled(cpu);
return -ENOMEM;
}
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]