Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=12d00f6a121877235a5cacc56386936dd9bb81af
Commit:     12d00f6a121877235a5cacc56386936dd9bb81af
Parent:     fbf1e473bd0ecc080a4c37bb89848b16c59ac18b
Author:     Akinobu Mita <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 18 03:05:11 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Oct 18 14:37:21 2007 -0700

    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 <[EMAIL PROTECTED]>
    Cc: Gautham R Shenoy <[EMAIL PROTECTED]>
    Acked-by: Pekka Enberg <[EMAIL PROTECTED]>
    Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]>
    Cc: Gautham R Shenoy <[EMAIL PROTECTED]>
    Cc: Oleg Nesterov <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/slab.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 6715884..54eb555 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1282,13 +1282,18 @@ static int __cpuinit cpuup_prepare(long cpu)
                        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 cpu)
        }
        return 0;
 bad:
+       cpuup_canceled(cpu);
        return -ENOMEM;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to