From: sashiko-bot@kernel.org
To: "Jacob Moroni" <jmoroni@google.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next 1/2] RDMA/irdma: Wait for all refs to drop when destroying RoCE QPs
Date: Thu, 26 Nov 2026 19:04:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-236047@kernel.org> (raw)
In-Reply-To: <20261126185344.2784303-1-jmoroni@google.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/irdma: use-after-free from incomplete CQ scrub in
irdma_clean_cqes() [1]
--
commit ec08c5024cb50836ff76a6f7d89b61c4ac172b85
Author: Jacob Moroni <jmoroni@google.com>
RDMA/irdma: Wait for all refs to drop when destroying RoCE QPs
This commit restores waiting on iwqp->free_qp when destroying RoCE QPs
during a device reset so that transient references from the AEQ handler
or disconnect work finish before the QP is freed.
> diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> index e07b6b40dd992..29ccd19da0321 100644
> --- a/drivers/infiniband/hw/irdma/verbs.c
> +++ b/drivers/infiniband/hw/irdma/verbs.c
> @@ -592,7 +592,7 @@ static void _irdma_destroy_qp(struct ib_qp *ibqp)
> }
>
> irdma_qp_rem_ref(&iwqp->ibqp);
> - if (!iwdev->rf->reset)
> + if (!iwdev->rf->reset || iwdev->roce_mode)
> wait_for_completion(&iwqp->free_qp);
> irdma_free_lsmm_rsrc(iwqp);
> irdma_cqp_qp_destroy_cmd(&iwdev->rf->sc_dev, &iwqp->sc_qp);
[Severity: High]
This problem wasn't introduced by this patch, but can _irdma_destroy_qp()
leave behind stale completions for the QP on iwcq->cmpl_generated and
iwcq->resize_list [1]?
Earlier in _irdma_destroy_qp(), transitioning a kernel QP to error can
queue software flush completions onto iwcq->cmpl_generated, and earlier
irdma_resize_cq() calls can leave unpolled CQ buffers on
iwcq->resize_list. However, irdma_clean_cqes() only scrubs the active CQ
ring:
drivers/infiniband/hw/irdma/verbs.c:irdma_clean_cqes() {
struct irdma_cq_uk *ukcq = &iwcq->sc_cq.cq_uk;
unsigned long flags;
spin_lock_irqsave(&iwcq->lock, flags);
irdma_uk_clean_cq(&iwqp->sc_qp.qp_uk, ukcq);
spin_unlock_irqrestore(&iwcq->lock, flags);
}
After _irdma_destroy_qp() frees the QP, a subsequent irdma_poll_cq() can
pull those remaining entries and dereference the dangling qp_handle in
irdma_uk_cq_poll_cmpl() and irdma_process_cqe(), causing a use-after-free
of struct irdma_qp.
[1] https://sashiko.dev/#/bug/linux-e3f313d2-d1fd-48a1-8be3-bb6bfb32a341
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126185344.2784303-1-jmoroni@google.com?part=1
next prev parent reply other threads:[~2026-11-26 19:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 18:53 [PATCH rdma-next 1/2] RDMA/irdma: Wait for all refs to drop when destroying RoCE QPs Jacob Moroni
2026-11-26 18:53 ` [PATCH rdma-next 2/2] RDMA/irdma: Scrub software flush completions on QP destroy Jacob Moroni
2026-11-26 19:04 ` sashiko-bot [this message]
2026-11-26 19:14 ` [PATCH rdma-next 1/2] RDMA/irdma: Wait for all refs to drop when destroying RoCE QPs Jacob Moroni
2026-11-26 19:04 ` 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=sashiko-outbox-236047@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jmoroni@google.com \
--cc=linux-rdma@vger.kernel.org \
--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