ARM: dma-mapping: Fix potential memory leak in atomic_pool_init()
authorSachin Kamat <sachin.kamat@linaro.org>
Mon, 24 Sep 2012 06:35:03 +0000 (08:35 +0200)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 24 Sep 2012 06:35:03 +0000 (08:35 +0200)
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 <arnd@arndb.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
arch/arm/mm/dma-mapping.c

index e59c4ab..13f555d 100644 (file)
@@ -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: