!186 libhns: Fixed two bugs in libhns

From: @cxh269 
Reviewed-by: @hellotcc 
Signed-off-by: @hellotcc
This commit is contained in:
openeuler-ci-bot 2025-01-06 02:00:44 +00:00 committed by Gitee
commit 43cb954f0a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 485cddd47c83d6f229450b28d55d8e07f60ddcc0 Mon Sep 17 00:00:00 2001
From: Yuyu Li <liyuyu6@huawei.com>
Date: Thu, 21 Nov 2024 21:37:15 +0800
Subject: [PATCH] libhns: Fix bypassed vendor check in hnsdv_query_device()
driver inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IBF87T
--------------------------------------------------------------------------
The device vendor check is actually bypassed currently due
to the wrong if-condition. It should be a '||' statement.
Fixes: 19e1eabc154f ("libhns: Add input parameter check for hnsdv_query_device()")
Signed-off-by: Yuyu Li <liyuyu6@huawei.com>
---
providers/hns/hns_roce_u_verbs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index 090efbf..a6afce2 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -128,10 +128,10 @@ int hnsdv_query_device(struct ibv_context *context,
struct hns_roce_context *ctx = context ? to_hr_ctx(context) : NULL;
struct hns_roce_device *hr_dev;
- if (!ctx || !attrs_out)
+ if (!ctx || !context->device || !attrs_out)
return EINVAL;
- if (!context->device && !is_hns_dev(context->device)) {
+ if (!is_hns_dev(context->device)) {
verbs_err(verbs_get_ctx(context), "not a HNS RoCE device!\n");
return EOPNOTSUPP;
}
--
2.33.0

View File

@ -0,0 +1,53 @@
From ad5055f9b32ab0915803575385985fb10a29434a Mon Sep 17 00:00:00 2001
From: Yuyu Li <liyuyu6@huawei.com>
Date: Mon, 25 Nov 2024 15:42:16 +0800
Subject: [PATCH] libhns: Fix coredump during QP destruction when send_cq
== recv_cq
driver inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IBF87T
--------------------------------------------------------------------------
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: 5bebdb5ba77b ("libhns: Support reporting wc as software mode")
Signed-off-by: Yuyu Li <liyuyu6@huawei.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 8f071e1..48a7566 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -2033,9 +2033,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: 41.0
Release: 28
Release: 29
Summary: RDMA core userspace libraries and daemons
License: GPLv2 or BSD
Url: https://github.com/linux-rdma/rdma-core
@ -94,6 +94,8 @@ patch85: 0085-libhns-Fix-memory-leakage-when-DCA-is-enabled.patch
patch86: 0086-libhns-Fix-the-exception-branch-of-wr_start-is-not-l.patch
patch87: 0087-libhns-Fix-out-of-order-issue-of-requester-when-sett.patch
patch88: 0088-libhns-Fix-reference-to-uninitialized-cq-pointer.patch
patch89: 0089-libhns-Fix-bypassed-vendor-check-in-hnsdv_query_devi.patch
patch90: 0090-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) valgrind-devel systemd systemd-devel
@ -341,6 +343,12 @@ fi
%{_mandir}/*
%changelog
* Thu Jan 2 2025 Xinghai Cen <cenxinghai@h-partners.com> - 41.0-29
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Fixed two bugs in libhns
* Thu Nov 21 2024 Wentao Hu <huwentao19@h-partners.com> - 41.0-28
- Type: bugfix
- ID: NA