From: sashiko-bot@kernel.org
To: "Yuho Choi" <oss.patchbox@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next] RDMA/bnxt_re: Don't republish a QP whose destroy failed
Date: Tue, 24 Nov 2026 02:00:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-230364@kernel.org> (raw)
In-Reply-To: <20261124015141.294866-2-oss.patchbox@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] RDMA/bnxt_re: data race in bnxt_qplib_create_qp1() [1]
--
commit 1b21d21008b23e4ba7182837a1d5e17b617eab26
Author: Yuho Choi <oss.patchbox@gmail.com>
RDMA/bnxt_re: Don't republish a QP whose destroy failed
This commit drops the rcfw->qp_tbl rollback in bnxt_qplib_destroy_qp() so a
QP is not reinserted into the table if the DESTROY_QP firmware command
fails.
> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
> index 5301e4f21ade0..a5660002d1840 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);
> }
[Severity: High]
This problem wasn't introduced by this patch, but shouldn't
bnxt_qplib_create_qp1() also hold rcfw->tbl_lock when populating
rcfw->qp_tbl [1]?
drivers/infiniband/hw/bnxt_re/qplib_fp.c:bnxt_qplib_create_qp1() {
...
tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp;
return 0;
...
}
Once bnxt_qplib_rcfw_send_message() completes CREATE_QP1, firmware can
emit events for the new QP while bnxt_qplib_create_qp1() is still running:
CPU0 CPU1 (CREQ tasklet)
bnxt_qplib_create_qp1()
bnxt_qplib_rcfw_send_message()
bnxt_qplib_process_qp_event()
spin_lock(&rcfw->tbl_lock)
rcfw->qp_tbl[tbl_indx].qp_id = ...
rcfw->qp_tbl[tbl_indx].qp_handle = ...
reads rcfw->qp_tbl[tbl_indx]
<-- data race
spin_unlock(&rcfw->tbl_lock)
Without rcfw->tbl_lock, bnxt_qplib_process_qp_event() can observe a
partially updated qp_tbl entry, missing a QP error notification or
dereferencing an uninitialized qp_handle.
[1] https://sashiko.dev/#/bug/linux-c8dafdae-4eb3-4ddb-a2a2-5d1da6ca2da5
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124015141.294866-2-oss.patchbox@gmail.com?part=1
prev parent reply other threads:[~2026-11-24 2:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 1:51 [PATCH rdma-next] RDMA/bnxt_re: Don't republish a QP whose destroy failed Yuho Choi
2026-11-24 2:00 ` sashiko-bot [this message]
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=sashiko-outbox-230364@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=oss.patchbox@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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