From: Bernard Metzler <bernard.metzler@linux.dev>
To: "Jérémy Jean" <Jeremy.Jean@oss.cyber.gouv.fr>
Cc: jgg@nvidia.com, leonro@nvidia.com, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/siw: Bound fragmented header copies by the remaining length
Date: Tue, 8 Sep 2026 15:12:16 +0200 [thread overview]
Message-ID: <7492fc56-fbce-4665-ad2e-25a38685e20c@linux.dev> (raw)
In-Reply-To: <20260908085520.1746329-1-Jeremy.Jean@oss.cyber.gouv.fr>
On 08.09.2026 10:55, Jérémy Jean wrote:
> siw_get_hdr() can receive an extended DDP/RDMAP header across more than
> one TCP callback. The first callback may receive most of the header,
> while the next one still limits the copy to hdrlen - MIN_DDP_HDR instead
> of the number of missing bytes. This makes the destination move past the
> end of the header and overwrite the receive state, including
> fpdu_part_rcvd. A later callback can then use a negative fpdu_part_rcvd
> value as a copy offset, which creates an OOB write.
>
Excellent finding, thank you! That must trickle down to older stable.
> Use the number of header bytes already received when calculating the
> next copy length.
>
> Fixes: 754209850df8 ("RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall.")
> Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
> Assisted-by: Codex:gpt-6
> ---
> drivers/infiniband/sw/siw/siw_qp_rx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c
> index b566d16..e5b641c 100644
> --- a/drivers/infiniband/sw/siw/siw_qp_rx.c
> +++ b/drivers/infiniband/sw/siw/siw_qp_rx.c
> @@ -1079,7 +1079,7 @@ static int siw_get_hdr(struct siw_rx_stream *srx)
> if (iwarp_pktinfo[opcode].hdr_len > sizeof(struct iwarp_ctrl_tagged)) {
> int hdrlen = iwarp_pktinfo[opcode].hdr_len;
>
> - bytes = min_t(int, hdrlen - MIN_DDP_HDR, srx->skb_new);
> + bytes = min_t(int, hdrlen - srx->fpdu_part_rcvd, srx->skb_new);
>
> skb_copy_bits(skb, srx->skb_offset,
> (char *)c_hdr + srx->fpdu_part_rcvd, bytes);
Acked-by: Bernard Metzler <bernard.metzler@linux.dev>
next prev parent reply other threads:[~2026-09-08 13:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 8:55 Jérémy Jean
2026-09-08 13:12 ` Bernard Metzler [this message]
2026-09-10 15: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=7492fc56-fbce-4665-ad2e-25a38685e20c@linux.dev \
--to=bernard.metzler@linux.dev \
--cc=Jeremy.Jean@oss.cyber.gouv.fr \
--cc=jgg@nvidia.com \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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
all inboxes | Powered by JetHome®