rdma-core/0040-libhns-Fix-memory-leakage-when-DCA-is-enabled.patch
Xinghai Cen 70a9c89044 libhns: Fixes several bugs for libhns
Fixes several bugs for libhns:
libhns: Fix memory leakage when DCA is enabled
libhns: Fix the exception branch of wr_start() is not locked

Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
(cherry picked from commit 62a65084134c9b3be711dc25ef02b900a7b9a345)
2024-11-25 17:11:45 +08:00

41 lines
1.2 KiB
Diff

From edaf09dbfc7203ea68becfcb56eecf4af31ba555 Mon Sep 17 00:00:00 2001
From: wenglianfa <wenglianfa@huawei.com>
Date: Thu, 25 Jul 2024 11:06:01 +0800
Subject: [PATCH] libhns: Fix memory leakage when DCA is enabled
driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IB66RT
------------------------------------------------------------------
After DCA is enabled and a QP is created, the memory block
applied for DCA is not free when the QP is destroyed. Here
fix it.
Fixes: 41e39ab792c8 ("[BigDipperV3R9,NeZha][ROCE] libhns: Add support for at taching QP's WQE buffer")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
---
providers/hns/hns_roce_u_verbs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index e30880c..c733b21 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -1357,7 +1357,8 @@ static void qp_free_wqe(struct hns_roce_qp *qp)
if (qp->rq.wqe_cnt)
free(qp->rq.wrid);
- hns_roce_free_buf(&qp->buf);
+ else
+ hns_roce_free_buf(&qp->buf);
}
static int qp_alloc_wqe(struct ibv_qp_init_attr_ex *attr,
--
2.25.1