* [PATCH] IB/hfi1: prevent memory leak in sdma_init
@ 2019-09-25 14:45 Navid Emamdoost
2019-09-26 11:49 ` Dennis Dalessandro
0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-09-25 14:45 UTC (permalink / raw)
Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Mike Marciniszyn,
Dennis Dalessandro, Doug Ledford, Jason Gunthorpe, linux-rdma,
linux-kernel
In sdma_init if rhashtable_init fails the allocated memory for
tmp_sdma_rht should be released.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] IB/hfi1: prevent memory leak in sdma_init
2019-09-25 14:45 [PATCH] IB/hfi1: prevent memory leak in sdma_init Navid Emamdoost
@ 2019-09-26 11:49 ` Dennis Dalessandro
0 siblings, 0 replies; 2+ messages in thread
From: Dennis Dalessandro @ 2019-09-26 11:49 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Mike Marciniszyn, Doug Ledford,
Jason Gunthorpe, linux-rdma, linux-kernel
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@gmail.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@intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-26 11:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-25 14:45 [PATCH] IB/hfi1: prevent memory leak in sdma_init Navid Emamdoost
2019-09-26 11:49 ` Dennis Dalessandro
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).