[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHuBVBa-vMT4Bx1oAxVGnMgyh5ZkreRzW052OtemZyaZpL6LWg@mail.gmail.com>
Date: Thu, 26 Sep 2013 14:14:39 +0300
From: Valentin Ilie <valentin.ilie@...il.com>
To: balbi@...com, gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Valentin Ilie <valentin.ilie@...il.com>
Subject: Re: [PATCH] usb: gadget: mv_u3d_core: fix memory leaks
On 21 September 2013 12:30, Valentin Ilie <valentin.ilie@...il.com> wrote:
> When trb_hw is NULL, trb should be free'd before return.
>
> Signed-off-by: Valentin Ilie <valentin.ilie@...il.com>
> ---
> drivers/usb/gadget/mv_u3d_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/mv_u3d_core.c b/drivers/usb/gadget/mv_u3d_core.c
> index 561b30e..4d31177 100644
> --- a/drivers/usb/gadget/mv_u3d_core.c
> +++ b/drivers/usb/gadget/mv_u3d_core.c
> @@ -310,6 +310,7 @@ static struct mv_u3d_trb *mv_u3d_build_trb_one(struct mv_u3d_req *req,
> */
> trb_hw = dma_pool_alloc(u3d->trb_pool, GFP_ATOMIC, dma);
> if (!trb_hw) {
> + kfree(trb);
> dev_err(u3d->dev,
> "%s, dma_pool_alloc fail\n", __func__);
> return NULL;
> @@ -454,6 +455,7 @@ static int mv_u3d_req_to_trb(struct mv_u3d_req *req)
>
> trb_hw = kcalloc(trb_num, sizeof(*trb_hw), GFP_ATOMIC);
> if (!trb_hw) {
> + kfree(trb);
> dev_err(u3d->dev,
> "%s, trb_hw alloc fail\n", __func__);
> return -ENOMEM;
> --
> 1.7.9.5
>
Can anyone look into this?
Thank you
--
Valentin Ilie
+(40) 746 188 558
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists