From 816341b19c5e7138d44f3366afcc92d6edf8f434 Mon Sep 17 00:00:00 2001 From: wenglianfa Date: Wed, 12 Jun 2024 17:11:13 +0800 Subject: [PATCH] libhns: Fix the exception branch of wr_start() is not locked mainline inclusion from mainline-master commit d1d0ac518e20dc1eca4fcc62d091c69e20b114da category: feature bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IB66RT CVE: NA Reference: https://github.com/linux-rdma/rdma-core/pull/commits/d1d0ac518e20dc1eca4fcc62d091c69e20b114da ------------------------------------------------------------------ The provider should provide locking to ensure that ibv_wr_start() and ibv_wr_complete()/abort() form a per-QP critical section where no other threads can enter. The exception branch of wr_start() is not locked, fix it here. Because check_qp_send () does not require lock protection, hns_roce_spin_lock () is placed after check_qp_send (). Fixes: 36446a56eea5 ("libhns: Extended QP supports the new post send mechanism") Signed-off-by: wenglianfa Signed-off-by: Xinghai Cen --- providers/hns/hns_roce_u_hw_v2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index 465ef1e..e4232ea 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -2930,6 +2930,7 @@ static void wr_start(struct ibv_qp_ex *ibv_qp) ret = check_qp_send(qp, ctx); if (ret) { + hns_roce_spin_lock(&qp->sq.hr_lock); qp->err = ret; return; } -- 2.25.1