All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/hns: fix memory leak in hns_roce_alloc_mr()
@ 2022-11-19  7:08 Zhengchao Shao
  2022-11-22  6:34 ` xuhaoyue (A)
  2022-11-22 14:22 ` Leon Romanovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Zhengchao Shao @ 2022-11-19  7:08 UTC (permalink / raw)
  To: linux-rdma, xuhaoyue1, liangwenpeng
  Cc: jgg, leon, liweihang, chenglang, wangxi11, weiyongjun1,
	yuehaibing, shaozhengchao

When hns_roce_mr_enable() failed in hns_roce_alloc_mr(), mr_key is not
released. Compiled test only.

Fixes: 9b2cf76c9f05 ("RDMA/hns: Optimize PBL buffer allocation process")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_mr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index 845ac7d3831f..37a5cf62f88b 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -392,10 +392,10 @@ struct ib_mr *hns_roce_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
 
 	return &mr->ibmr;
 
-err_key:
-	free_mr_key(hr_dev, mr);
 err_pbl:
 	free_mr_pbl(hr_dev, mr);
+err_key:
+	free_mr_key(hr_dev, mr);
 err_free:
 	kfree(mr);
 	return ERR_PTR(ret);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/hns: fix memory leak in hns_roce_alloc_mr()
  2022-11-19  7:08 [PATCH] RDMA/hns: fix memory leak in hns_roce_alloc_mr() Zhengchao Shao
@ 2022-11-22  6:34 ` xuhaoyue (A)
  2022-11-22 14:22 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: xuhaoyue (A) @ 2022-11-22  6:34 UTC (permalink / raw)
  To: Zhengchao Shao, linux-rdma, liangwenpeng
  Cc: jgg, leon, liweihang, chenglang, wangxi11, weiyongjun1, yuehaibing

On 2022/11/19 15:08:34, Zhengchao Shao wrote:
> When hns_roce_mr_enable() failed in hns_roce_alloc_mr(), mr_key is not
> released. Compiled test only.
> 
> Fixes: 9b2cf76c9f05 ("RDMA/hns: Optimize PBL buffer allocation process")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
>  drivers/infiniband/hw/hns/hns_roce_mr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
> index 845ac7d3831f..37a5cf62f88b 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_mr.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
> @@ -392,10 +392,10 @@ struct ib_mr *hns_roce_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
>  
>  	return &mr->ibmr;
>  
> -err_key:
> -	free_mr_key(hr_dev, mr);
>  err_pbl:
>  	free_mr_pbl(hr_dev, mr);
> +err_key:
> +	free_mr_key(hr_dev, mr);
>  err_free:
>  	kfree(mr);
>  	return ERR_PTR(ret);
> 

Thank you. For the patch:
Acked-by Haoyue Xu <xuhaoyue1@hisilicon.com>

Regards,
Haoyue

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/hns: fix memory leak in hns_roce_alloc_mr()
  2022-11-19  7:08 [PATCH] RDMA/hns: fix memory leak in hns_roce_alloc_mr() Zhengchao Shao
  2022-11-22  6:34 ` xuhaoyue (A)
@ 2022-11-22 14:22 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-11-22 14:22 UTC (permalink / raw)
  To: linux-rdma, liangwenpeng, Zhengchao Shao, xuhaoyue1
  Cc: liweihang, wangxi11, jgg, yuehaibing, chenglang, weiyongjun1

On Sat, 19 Nov 2022 15:08:34 +0800, Zhengchao Shao wrote:
> When hns_roce_mr_enable() failed in hns_roce_alloc_mr(), mr_key is not
> released. Compiled test only.
> 
> 

Applied, thanks!

[1/1] RDMA/hns: fix memory leak in hns_roce_alloc_mr()
      https://git.kernel.org/rdma/rdma/c/a115aa00b18f7b

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-22 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19  7:08 [PATCH] RDMA/hns: fix memory leak in hns_roce_alloc_mr() Zhengchao Shao
2022-11-22  6:34 ` xuhaoyue (A)
2022-11-22 14:22 ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.