Skip to content

Commit

Permalink
ARM: dma-mapping: Fix potential memory leak in atomic_pool_init()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sachin Kamat authored and Marek Szyprowski committed Sep 24, 2012
1 parent 979570e commit ec10665
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ec10665

Please sign in to comment.