All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Abhijit Gangurde" <abhijit.gangurde@amd.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [for-next v4 4/5] RDMA/ionic: add Shared receive queue (SRQ) support
Date: Thu, 01 Oct 2026 09:24:19 +0000	[thread overview]
Message-ID: <20261001092420.0CA761F0089B@smtp.kernel.org> (raw)
In-Reply-To: <20260930092111.3176738-5-abhijit.gangurde@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] rdma/ionic: silent data loss when kernel polls SRQ-attached CQ
--

commit ccf1245b508acbe9a1128018da0500733eaed2c6
Author: Amit Kumar <a.k@amd.com>

RDMA/ionic: add Shared receive queue (SRQ) support

Implement device supported verb APIs for shared receive queue.
SRQ is supported for userspace only. ionic_create_srq() returns
-EOPNOTSUPP when there is no ucontext, so kernel ULPs cannot create an SRQ.

> diff --git a/drivers/infiniband/hw/ionic/ionic_datapath.c b/drivers/infiniband/hw/ionic/ionic_datapath.c
> index 522c6f08c9fdd..c5726c6bd5cb3 100644
> --- a/drivers/infiniband/hw/ionic/ionic_datapath.c
> +++ b/drivers/infiniband/hw/ionic/ionic_datapath.c

[ ... ]

> @@ -526,6 +526,12 @@ static int ionic_poll_vcq_cq(struct ionic_ibdev *dev,
>  
>  		switch (type) {
>  		case IONIC_V1_CQE_TYPE_RECV:
> +			if (qp->srq) {
> +				ibdev_dbg(&dev->ibdev,
> +					  "srq recv cqe for qp %u\n", qid);
> +				goto cq_next;
> +			}
> +

[Severity: Medium]
Does this logic in ionic_poll_vcq_cq result in silent data loss for SRQ
completions? 

If an unprivileged userspace application calls IB_USER_VERBS_CMD_POLL_CQ to
poll a memory-mapped CQ that receives completions for an SRQ-attached QP,
this block appears to process the CQE, skip it with goto cq_next, and free
the hardware slot without returning the completion to userspace.

>  			spin_lock(&qp->rq.lock);
>  			rc = ionic_poll_recv(dev, cq, qp, cqe, wc + npolled);

[Severity: High]
This is a pre-existing issue, but can the call to ionic_poll_recv here
trigger a NULL pointer dereference for userspace QPs?

If a userspace application calls IB_USER_VERBS_CMD_POLL_CQ to poll a CQ
containing completions for a userspace non-SRQ QP, ionic_poll_recv will
attempt to dereference qp->rq.meta[wqe_idx]:

drivers/infiniband/hw/ionic/ionic_datapath.c:ionic_poll_recv() {
    ...
    meta = &qp->rq.meta[wqe_idx];
    if (unlikely(meta->next != IONIC_META_POSTED)) {
    ...
}

Since rq.meta is explicitly set to NULL for userspace QPs during
initialization when udata is not NULL, this seems to lead to a kernel
crash upon accessing meta->next. Is this reachable by unprivileged
userspace applications?

>  			spin_unlock(&qp->rq.lock);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930092111.3176738-1-abhijit.gangurde@amd.com?part=4

  reply	other threads:[~2026-10-01  9:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  9:21 [for-next v4 0/5] RDMA/ionic: add SRQ support and firmware assigned CQ and SRQ IDs Abhijit Gangurde
2026-09-30  9:21 ` [for-next v4 1/5] net: ionic: Fetch qid allocation and SRQ capability from firmware Abhijit Gangurde
2026-10-01  9:24   ` sashiko-bot
2026-09-30  9:21 ` [for-next v4 2/5] RDMA/ionic: support firmware-assigned CQ IDs Abhijit Gangurde
2026-10-01  9:24   ` sashiko-bot
2026-09-30  9:21 ` [for-next v4 3/5] RDMA/ionic: segregate rq related fields from ionic_qp into a new ionic_rq struct Abhijit Gangurde
2026-10-01  9:24   ` sashiko-bot
2026-09-30  9:21 ` [for-next v4 4/5] RDMA/ionic: add Shared receive queue (SRQ) support Abhijit Gangurde
2026-10-01  9:24   ` sashiko-bot [this message]
2026-09-30  9:21 ` [for-next v4 5/5] RDMA/ionic: implement SRQ event handling support Abhijit Gangurde
2026-10-01  9:24   ` 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=20261001092420.0CA761F0089B@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=abhijit.gangurde@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.