[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100819144956.27058.69126.stgit@e102109-lin.cambridge.arm.com>
Date: Thu, 19 Aug 2010 15:49:56 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: linux-kernel@...r.kernel.org
Cc: Tejun Heo <tj@...nel.org>
Subject: [PATCH] percpu: Fix memory leak from percpu_init_late()
The chunk->map memory block allocated in percpu_init_late() (as of
commit 099a19d9) is later overridden in pcpu_extend_area_map(). The
patch frees this existing block in the latter function. Found by
kmemleak.
Signed-off-by: Catalin Marinas <catalin.marinas@....com>
Cc: Tejun Heo <tj@...nel.org>
---
mm/percpu.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/mm/percpu.c b/mm/percpu.c
index e61dc2c..c0d3329 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -394,6 +394,7 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc)
old_size = chunk->map_alloc * sizeof(chunk->map[0]);
memcpy(new, chunk->map, old_size);
+ pcpu_mem_free(chunk->map, old_size);
chunk->map_alloc = new_alloc;
chunk->map = new;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists