Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Youngsung Ahn" <ays511.kr@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH v2] RDMA/rxe: validate inline sge_offset in finish_packet() before indexing inline_data[]
Date: Thu, 01 Oct 2026 15:37:24 +0000	[thread overview]
Message-ID: <20261001153725.53FE51F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261001152433.3259573-1-ays511.kr@gmail.com>

> For a user QP, rxe_post_send() takes the qp->is_user branch and
> never runs init_send_wqe(), so
> dma.length/resid/num_sge/cur_sge/sge_offset all come straight from
> the mmap'd SQ ring. In the inline send path finish_packet() uses
> sge_offset directly as an index:
> 
> 	u8 *tmp = &wqe->dma.inline_data[wqe->dma.sge_offset];
> 	memcpy(payload_addr(pkt), tmp, payload);
> 
> inline_data is a flex array whose capacity is qp->sq.max_inline, but
> sge_offset is a u32 from user space, so the source pointer is
> displaced arbitrarily past the WQE and the memcpy reads out of
> bounds.
> commit 126c757e4cd4 ("RDMA/rxe: Validate num_sge/cur_sge before indexing wqe->dma.sge[]")
> added num_sge/cur_sge checks on the send path but not sge_offset, the
> third attacker-controlled index in the same struct.
> 
> Read sge_offset once with READ_ONCE() and bound it (and the payload
> that follows it) by qp->sq.max_inline before indexing, so the value
> that is validated is the value that is used.
> 
> Fixes: 8700e3e7c485 ("Soft RoCE driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Youngsung Ahn <ays511.kr@gmail.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261001152433.3259573-1-ays511.kr@gmail.com?part=1


  reply	other threads:[~2026-10-01 15:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 18:22 [PATCH] RDMA/rxe: validate inline sge_offset in finish_packet() before indexing inline_data[] Youngsung Ahn
2026-09-30 18:41 ` sashiko-bot
2026-10-01 15:24 ` [PATCH v2] " Youngsung Ahn
2026-10-01 15:37   ` sashiko-bot [this message]
2026-10-01 16:15   ` Leon Romanovsky

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=20261001153725.53FE51F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ays511.kr@gmail.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