From ec10665cbf271fb1f60daeb194ad4f2cdcdc59d9 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 24 Sep 2012 08:35:03 +0200 Subject: ARM: dma-mapping: Fix potential memory leak in atomic_pool_init() When either of __alloc_from_contiguous or __alloc_remap_buffer fails to provide a valid pointer, allocated memory is freed up and an error is returned. 'pages' was however not freed before returning error. Cc: Arnd Bergmann Cc: Marek Szyprowski Signed-off-by: Sachin Kamat Signed-off-by: Marek Szyprowski --- arch/arm/mm/dma-mapping.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/arm') diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e59c4ab71bcb..13f555d62491 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -346,6 +346,8 @@ static int __init atomic_pool_init(void) (unsigned)pool->size / 1024); return 0; } + + kfree(pages); no_pages: kfree(bitmap); no_bitmap: -- cgit v1.2.3