diff mbox series

[rdma-next] RDMA/hns: Fix PD memory leak for internal allocation

Message ID 20190520064353.8523-1-leon@kernel.org (mailing list archive)
State Mainlined
Commit 619122be3d40c835eb5fad9e326780909926495d
Delegated to: Jason Gunthorpe
Headers show
Series [rdma-next] RDMA/hns: Fix PD memory leak for internal allocation | expand

Commit Message

Leon Romanovsky May 20, 2019, 6:43 a.m. UTC
From: Leon Romanovsky <leonro@mellanox.com>

free_pd is allocated internally by hns driver hence needs to be
freed internally too.

Fixes: 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jason Gunthorpe May 21, 2019, 6:26 p.m. UTC | #1
On Mon, May 20, 2019 at 09:43:53AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> free_pd is allocated internally by hns driver hence needs to be
> freed internally too.
> 
> Fixes: 21a428a019c9 ("RDMA: Handle PD allocations by IB/core")
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 +
>  1 file changed, 1 insertion(+)

Applied to for-rc, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 4c5d0f160c10..e068a02122f5 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -899,6 +899,7 @@  static void hns_roce_v1_release_lp_qp(struct hns_roce_dev *hr_dev)
 		dev_err(dev, "Destroy cq for mr_free failed(%d)!\n", ret);
 
 	hns_roce_dealloc_pd(&free_mr->mr_free_pd->ibpd, NULL);
+	kfree(&free_mr->mr_free_pd->ibpd);
 }
 
 static int hns_roce_db_init(struct hns_roce_dev *hr_dev)