diff options
author | Huang Shijie <shijie8@gmail.com> | 2010-08-08 14:39:07 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-08-27 11:36:08 +0200 |
commit | a002d148426f40bc2b7dc066982eb177cdebeaaa (patch) | |
tree | 2b499e19cd7431b077eefe53dbcde8dbe71d3097 /mm/percpu.c | |
parent | percpu: add __percpu notations to UP allocator (diff) | |
download | linux-a002d148426f40bc2b7dc066982eb177cdebeaaa.tar.xz linux-a002d148426f40bc2b7dc066982eb177cdebeaaa.zip |
percpu: fix a memory leak in pcpu_extend_area_map()
The original code did not free the old map. This patch fixes it.
tj: use @old as memcpy source instead of @chunk->map, and indentation
and description update
Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@kernel.org
Diffstat (limited to 'mm/percpu.c')
-rw-r--r-- | mm/percpu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/percpu.c b/mm/percpu.c index e61dc2cc5873..a1830d8e3318 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -393,7 +393,9 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) goto out_unlock; old_size = chunk->map_alloc * sizeof(chunk->map[0]); - memcpy(new, chunk->map, old_size); + old = chunk->map; + + memcpy(new, old, old_size); chunk->map_alloc = new_alloc; chunk->map = new; |