From: Yuho Choi <oss.patchbox@gmail.com>
To: Selvin Xavier <selvin.xavier@broadcom.com>,
Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH rdma-next] RDMA/bnxt_re: Don't republish a QP whose destroy failed
Date: Tue, 24 Nov 2026 01:51:36 +0000 [thread overview]
Message-ID: <20261124015141.294866-2-oss.patchbox@gmail.com> (raw)
bnxt_qplib_destroy_qp() removes the QP from rcfw->qp_tbl before sending
DESTROY_QP and re-inserts it if bnxt_qplib_rcfw_send_message() fails.
No caller uses the QP after a failure, though:
- bnxt_re_destroy_qp() logs the error and returns 0 since
commit d507d29bfde3 ("RDMA/bnxt_re: Don't fail destroy QP and cleanup
debugfs earlier"), so the IB core frees the QP.
- bnxt_re_destroy_gsi_sqp() logs the error and frees gsi_sqp.
- bnxt_re_create_qp() frees the QP resources and returns the error so the
IB core frees the QP.
- bnxt_re_create_shadow_gsi() abandons the shadow QP on failure.
Moreover, on the error paths of bnxt_qplib_create_qp() and
bnxt_qplib_create_qp1(), bnxt_qplib_destroy_qp() is called before the QP
is even inserted into rcfw->qp_tbl (and before sq_flush/rq_flush are
initialized in bnxt_qplib_create_qp()), so the rollback publishes a
half-initialized QP that is about to be freed.
Except for the abandoned shadow QP, the QP is freed right after, so
rcfw->qp_tbl is left with a dangling pointer. On a later QP error
notification, bnxt_qplib_process_qp_event() marks that QP in error and
passes it to the async event handler.
Drop the rollback so the QP stays out of rcfw->qp_tbl when DESTROY_QP
fails.
Fixes: f218d67ef004 ("RDMA/bnxt_re: Allow posting when QPs are in error")
Fixes: d507d29bfde3 ("RDMA/bnxt_re: Don't fail destroy QP and cleanup debugfs earlier")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Compile-tested only (x86_64 with INFINIBAND_BNXT_RE, W=1). I have no
NetXtreme-E RoCE hardware, and DESTROY_QP only fails when the firmware
times out or returns an error status, so I could not trigger it.
drivers/infiniband/hw/bnxt_re/qplib_fp.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index 5301e4f21ade..a5660002d184 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -1473,7 +1473,6 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
struct bnxt_qplib_cmdqmsg msg = {};
struct cmdq_destroy_qp req = {};
u32 tbl_indx;
- int rc;
spin_lock_bh(&rcfw->tbl_lock);
tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
@@ -1488,16 +1487,11 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
req.qp_cid = cpu_to_le32(qp->id);
bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req),
sizeof(resp), 0);
- rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
- if (rc) {
- spin_lock_bh(&rcfw->tbl_lock);
- rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
- rcfw->qp_tbl[tbl_indx].qp_handle = qp;
- spin_unlock_bh(&rcfw->tbl_lock);
- return rc;
- }
-
- return 0;
+ /*
+ * Don't put the QP back into qp_tbl if the command fails: no caller
+ * uses the QP after a failure, and most of them free it right away.
+ */
+ return bnxt_qplib_rcfw_send_message(rcfw, &msg);
}
void bnxt_qplib_free_qp_res(struct bnxt_qplib_res *res,
base-commit: 8dac6df92a2e66e2098bbc69061964cfe7e8375b
--
2.56.1
next reply other threads:[~2026-11-24 1:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 1:51 Yuho Choi [this message]
2026-11-24 2:00 ` [PATCH rdma-next] RDMA/bnxt_re: Don't republish a QP whose destroy failed sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124015141.294866-2-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=jgg@ziepe.ca \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=selvin.xavier@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox