[SPARC64]: Fix leak when DR added cpu does not bootup.
authorDavid S. Miller <davem@sunset.davemloft.net>
Sun, 15 Jul 2007 08:08:03 +0000 (01:08 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 16 Jul 2007 11:05:15 +0000 (04:05 -0700)
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/smp.c

index 69a1183c622d13607a1b5c697103f0d4faa96858..6956845b03fa9a49f489003d0f6557ae83ccf0dc 100644 (file)
@@ -90,7 +90,6 @@ static volatile unsigned long callin_flag = 0;
 void __devinit smp_callin(void)
 {
        int cpuid = hard_smp_processor_id();
-       struct trap_per_cpu *tb = &trap_block[cpuid];;
 
        __local_per_cpu_offset = __per_cpu_offset(cpuid);
 
@@ -119,11 +118,6 @@ void __devinit smp_callin(void)
        atomic_inc(&init_mm.mm_count);
        current->active_mm = &init_mm;
 
-       if (tb->hdesc) {
-               kfree(tb->hdesc);
-               tb->hdesc = NULL;
-       }
-
        while (!cpu_isset(cpuid, smp_commenced_mask))
                rmb();
 
@@ -345,6 +339,7 @@ static struct thread_info *cpu_new_thread = NULL;
 
 static int __devinit smp_boot_one_cpu(unsigned int cpu)
 {
+       struct trap_per_cpu *tb = &trap_block[cpu];
        unsigned long entry =
                (unsigned long)(&sparc64_cpu_startup);
        unsigned long cookie =
@@ -389,6 +384,11 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu)
        }
        cpu_new_thread = NULL;
 
+       if (tb->hdesc) {
+               kfree(tb->hdesc);
+               tb->hdesc = NULL;
+       }
+
        return ret;
 }