x86: fix duplicate free in setup_pcpu_remap() failure path
authorTejun Heo <tj@kernel.org>
Mon, 22 Jun 2009 02:56:24 +0000 (11:56 +0900)
committerTejun Heo <tj@kernel.org>
Mon, 22 Jun 2009 02:56:24 +0000 (11:56 +0900)
In the failure path, setup_pcpu_remap() tries to free the area which
has already been freed to make holes in the large page.  Fix it.

[ Impact: fix duplicate free in failure path ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/setup_percpu.c

index 9c3f0823e6aa00ea93bec0babdfd2c0b19971d13..dfbc7e6c64d40809cab4d4250765bd277156f866 100644 (file)
@@ -228,7 +228,7 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
 enomem:
        for_each_possible_cpu(cpu)
                if (pcpur_ptrs[cpu])
-                       free_bootmem(__pa(pcpur_ptrs[cpu]), PMD_SIZE);
+                       free_bootmem(__pa(pcpur_ptrs[cpu]), pcpur_size);
        ret = -ENOMEM;
 out_free_ar:
        free_bootmem(__pa(pcpur_ptrs), ptrs_size);