linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: dma-mapping: Fix potential memory leak in atomic_pool_init()
Date: Mon, 24 Sep 2012 09:05:08 +0200	[thread overview]
Message-ID: <049301cd9a22$f0b8c960$d22a5c20$%szyprowski@samsung.com> (raw)
In-Reply-To: <1347858583-13338-1-git-send-email-sachin.kamat@linaro.org>

Hello,

On Monday, September 17, 2012 7:10 AM Sachin Kamat wrote:

> 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>
> ---
>  arch/arm/mm/dma-mapping.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index 546a3e8..477a2d2 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -367,6 +367,8 @@ static int __init atomic_pool_init(void)
>  		       (unsigned)pool->size / 1024);
>  		return 0;
>  	}
> +
> +	kfree(pages);
>  no_pages:
>  	kfree(bitmap);
>  no_bitmap:
> --
> 1.7.4.1

Applied to my fixes-for-3.6 branch. Thanks for spotting this issue!

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

      reply	other threads:[~2012-09-24  7:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17  5:09 [PATCH] ARM: dma-mapping: Fix potential memory leak in atomic_pool_init() Sachin Kamat
2012-09-24  7:05 ` Marek Szyprowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='049301cd9a22$f0b8c960$d22a5c20$%szyprowski@samsung.com' \
    --to=m.szyprowski@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).