Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Stefan Metzmacher <metze@samba.org>
Cc: linkinjeon@kernel.org, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] smb: smbdirect: fix buffer length underflow in RDMA transfers" failed to apply to 6.18-stable tree
Date: Wed, 4 Nov 2026 14:24:33 -0500	[thread overview]
Message-ID: <2026110423-sediment-landing-8a9d@gregkh> (raw)
In-Reply-To: <456026fe-5cf5-4a35-bf82-75d5ed652846@samba.org>

On Wed, Nov 04, 2026 at 08:12:22PM +0100, Stefan Metzmacher wrote:
> Am 04.11.26 um 19:29 schrieb gregkh@linuxfoundation.org:
> > 
> > The patch below does not apply to the 6.18-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> > 
> > To reproduce the conflict and resubmit, you may use the following commands:
> > 
> > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
> > git checkout FETCH_HEAD
> > git cherry-pick -x 7193241a49c958782ba4b8df06da3734d1e317d2
> > # <resolve conflicts, build, test, etc.>
> > git commit -s
> > git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026110436-thee-asleep-2059@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
> > 
> > Possible dependencies:
> > 
> > 
> > 
> > thanks,
> > 
> > greg k-h
> > 
> > ------------------ original commit in Linus's tree ------------------
> > 
> >  From 7193241a49c958782ba4b8df06da3734d1e317d2 Mon Sep 17 00:00:00 2001
> > From: Stefan Metzmacher <metze@samba.org>
> > Date: Fri, 23 Oct 2026 19:26:09 +0900
> > Subject: [PATCH] smb: smbdirect: fix buffer length underflow in RDMA transfers
> > 
> > When a remote buffer descriptor is larger than the remaining local
> > buffer, smbdirect_connection_rdma_xmit() clamps its length and sets
> > buf_len to zero. The common accounting code then subtracts the clamped
> > length from buf_len, causing it to underflow. If another descriptor
> > follows, the loop processes it with a wrapped remaining length and
> > includes memory beyond the local buffer in the RDMA transfer.
> > 
> > A client can trigger an out-of-bounds kernel write with an SMB WRITE
> > request, or an out-of-bounds kernel read with an SMB READ request, by
> > supplying multiple RDMA buffer descriptors with an oversized descriptor
> > before the last one.
> > 
> > Remove the premature assignment to buf_len. Subtracting the clamped length
> > already consumes the remaining buffer, so the next iteration stops and
> > only descriptors within the local buffer are used to build work requests.
> > 
> > Fixes: e628bf939aaf ("ksmbd: reduce descriptor size if remaining bytes is less than request size")
> > Cc: stable@vger.kernel.org
> > Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-33549
> > Signed-off-by: Stefan Metzmacher <metze@samba.org>
> > Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
> > 
> > diff --git a/fs/smb/smbdirect/rw.c b/fs/smb/smbdirect/rw.c
> > index 6fe38042cfb9..cb142c3c50b2 100644
> > --- a/fs/smb/smbdirect/rw.c
> > +++ b/fs/smb/smbdirect/rw.c
> > @@ -143,7 +143,6 @@ int smbdirect_connection_rdma_xmit(struct smbdirect_socket *sc,
> >   		if (desc_buf_len > buf_len) {
> >   			desc_buf_len = buf_len;
> >   			desc[i].length = cpu_to_le32(desc_buf_len);
> > -			buf_len = 0;
> >   		}
> >   		credits_needed += smbdirect_connection_calc_rw_credits(sc,
> 
> In older releases this is smb_direct_rdma_xmit() in fs/smb/server/transport_rdma.c
> 
> I hope that helps.

A backported patch would help best :)

  reply	other threads:[~2026-11-04 19:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 18:29 FAILED: patch "[PATCH] smb: smbdirect: fix buffer length underflow in RDMA transfers" failed to apply to 6.18-stable tree gregkh
2026-11-04 19:12 ` Stefan Metzmacher
2026-11-04 19:24   ` Greg KH [this message]
2026-11-04 20:25     ` Stefan Metzmacher

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=2026110423-sediment-landing-8a9d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linkinjeon@kernel.org \
    --cc=metze@samba.org \
    --cc=stable@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