[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <84ce2808-4447-cc13-1756-60617336fa1d@intel.com>
Date: Thu, 26 Sep 2019 07:49:03 -0400
From: Dennis Dalessandro <dennis.dalessandro@...el.com>
To: Navid Emamdoost <navid.emamdoost@...il.com>
Cc: emamd001@....edu, kjlu@....edu, smccaman@....edu,
Mike Marciniszyn <mike.marciniszyn@...el.com>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IB/hfi1: prevent memory leak in sdma_init
On 9/25/2019 10:45 AM, Navid Emamdoost wrote:
> In sdma_init if rhashtable_init fails the allocated memory for
> tmp_sdma_rht should be released.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---
> drivers/infiniband/hw/hfi1/sdma.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c
> index 2395fd4233a7..2ed7bfd5feea 100644
> --- a/drivers/infiniband/hw/hfi1/sdma.c
> +++ b/drivers/infiniband/hw/hfi1/sdma.c
> @@ -1526,8 +1526,11 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)
> }
>
> ret = rhashtable_init(tmp_sdma_rht, &sdma_rht_params);
> - if (ret < 0)
> + if (ret < 0) {
> + kfree(tmp_sdma_rht);
> goto bail;
> + }
> +
> dd->sdma_rht = tmp_sdma_rht;
>
> dd_dev_info(dd, "SDMA num_sdma: %u\n", dd->num_sdma);
>
Yeah looks like a problem to me, thanks.
Acked-by: Dennis Dalessandro <dennis.dalessandro@...el.com>
Powered by blists - more mailing lists