Commit a002d148426f40bc2b7dc066982eb177cdebeaaa

Authored by Huang Shijie
Committed by Tejun Heo
1 parent 94cb121c94

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

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

... ... @@ -393,7 +393,9 @@
393 393 goto out_unlock;
394 394  
395 395 old_size = chunk->map_alloc * sizeof(chunk->map[0]);
396   - memcpy(new, chunk->map, old_size);
  396 + old = chunk->map;
  397 +
  398 + memcpy(new, old, old_size);
397 399  
398 400 chunk->map_alloc = new_alloc;
399 401 chunk->map = new;