libhns: Fix coredump during QP destruction when send_cq == recv_cq

driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IB7JZL

------------------------------------------------------------------

If the specified send CQ and recv CQ are both
the same CQ, the QP node in SCQ is not deleted.
which causes a segfault to occur when recreating
the QP. Here fix it.

Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
(cherry picked from commit a8c29764ee5bbc28c181b8c57a6bd9d2802b25ca)
This commit is contained in:
Xinghai Cen 2024-11-28 11:34:16 +08:00 committed by openeuler-sync-bot
parent f0e4558f89
commit 76d34bf06c
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From 263479c6fb4712528ccae276960ec94fd77afc51 Mon Sep 17 00:00:00 2001
From: Yuyu Li <liyuyu6@huawei.com>
Date: Mon, 25 Nov 2024 16:13:48 +0800
Subject: [PATCH] libhns: Fix coredump during QP destruction when send_cq ==
recv_cq
driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IB7JZL
------------------------------------------------------------------
If the specified send CQ and recv CQ are both
the same CQ, the QP node in SCQ is not deleted.
which causes a segfault to occur when recreating
the QP. Here fix it.
coredump info:
0x0000ffff8fbc37d4 in list_add_before_
0x0000ffff8fbc381c in list_add_tail_
0x0000ffff8fbc9d9c in add_qp_to_cq_list
0x0000ffff8fbca008 in create_qp
0x0000ffff8fbca110 in hns_roce_u_create_qp
0x0000ffff8feae39c in __ibv_create_qp_1_1
0x0000000000401420 in test_ctrl_path
Fixes: 95e05809d2d2 ("[BigDipperV3R9,NeZha][ROCE] libhns: Support reporting wc as software mode")
Signed-off-by: Yuyu Li <liyuyu6@huawei.com>
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
---
providers/hns/hns_roce_u_hw_v2.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index e4232ea..c746e03 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -2006,9 +2006,10 @@ static int hns_roce_u_v2_destroy_qp(struct ibv_qp *ibqp)
list_del(&qp->rcq_node);
}
- if (ibqp->send_cq && ibqp->send_cq != ibqp->recv_cq) {
- __hns_roce_v2_cq_clean(to_hr_cq(ibqp->send_cq), ibqp->qp_num,
- NULL);
+ if (ibqp->send_cq) {
+ if (ibqp->send_cq != ibqp->recv_cq)
+ __hns_roce_v2_cq_clean(to_hr_cq(ibqp->send_cq), ibqp->qp_num,
+ NULL);
list_del(&qp->scq_node);
}
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: rdma-core
Version: 50.0
Release: 16
Release: 17
Summary: RDMA core userspace libraries and daemons
License: GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
Url: https://github.com/linux-rdma/rdma-core
@ -46,6 +46,7 @@ patch37: 0037-libhns-Fix-out-of-order-issue-of-requester-when-sett.patch
patch38: 0038-libhns-Fix-reference-to-uninitialized-cq-pointer.patch
patch39: 0039-libhns-Fix-the-exception-branch-of-wr_start-is-not-l.patch
patch40: 0040-libhns-Fix-memory-leakage-when-DCA-is-enabled.patch
patch41: 0041-libhns-Fix-coredump-during-QP-destruction-when-send_.patch
BuildRequires: binutils cmake >= 2.8.11 gcc libudev-devel pkgconfig pkgconfig(libnl-3.0)
BuildRequires: pkgconfig(libnl-route-3.0) systemd systemd-devel
@ -625,6 +626,12 @@ fi
%doc %{_docdir}/%{name}-%{version}/70-persistent-ipoib.rules
%changelog
* Thu Nov 28 2024 Xinghai Cen <cenxinghai@h-partners.com> - 50.0-17
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Fix coredump during QP destruction when send_cq == recv_cq
* Mon Nov 25 2024 Xinghai Cen <cenxinghai@h-partners.com> - 50.0-16
- Type: bugfix
- ID: NA