public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] percpu: Fix memory leak from percpu_init_late()
  2010-08-19 14:49 [PATCH] percpu: Fix memory leak from percpu_init_late() Catalin Marinas
@ 2010-08-19 14:48 ` Tejun Heo
  2010-08-19 15:59   ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2010-08-19 14:48 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-kernel

On 08/19/2010 04:49 PM, Catalin Marinas wrote:
> 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@arm.com>
> Cc: Tejun Heo <tj@kernel.org>

Patch already pending

 http://git.kernel.org/?p=linux/kernel/git/tj/percpu.git;a=commit;h=206c53730b8b1707becca7a868ea8d14ebee24d2

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] percpu: Fix memory leak from percpu_init_late()
@ 2010-08-19 14:49 Catalin Marinas
  2010-08-19 14:48 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2010-08-19 14:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo

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@arm.com>
Cc: Tejun Heo <tj@kernel.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;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] percpu: Fix memory leak from percpu_init_late()
  2010-08-19 14:48 ` Tejun Heo
@ 2010-08-19 15:59   ` Catalin Marinas
  0 siblings, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2010-08-19 15:59 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel

On Thu, 2010-08-19 at 15:48 +0100, Tejun Heo wrote:
> On 08/19/2010 04:49 PM, Catalin Marinas wrote:
> > 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@arm.com>
> > Cc: Tejun Heo <tj@kernel.org>
> 
> Patch already pending
> 
> 
> http://git.kernel.org/?p=linux/kernel/git/tj/percpu.git;a=commit;h=206c53730b8b1707becca7a868ea8d14ebee24d2

Great, thanks, I'm dropping mine.

-- 
Catalin


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-19 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19 14:49 [PATCH] percpu: Fix memory leak from percpu_init_late() Catalin Marinas
2010-08-19 14:48 ` Tejun Heo
2010-08-19 15:59   ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox