Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: zisenye@stu.xidian.edu.cn
Cc: linkinjeon@kernel.org, pc@manguebit.org,
	ronniesahlberg@gmail.com,  sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com,  senozhatsky@chromium.org,
	dhowells@redhat.com, gregkh@linuxfoundation.org,
	 chenxiaosong@chenxiaosong.com, stable@vger.kernel.org,
	 linux-cifs@vger.kernel.org
Subject: Re: [PATCH v4 1/1] smb/client: fix out-of-bounds read in smb2_compound_op()
Date: Wed, 6 May 2026 11:03:55 -0500	[thread overview]
Message-ID: <CAH2r5msBgZn6QC20gR1p8pMMv-iTKabPbqU78O1MzfW2-1r+JA@mail.gmail.com> (raw)
In-Reply-To: <20260506034908.3874700-2-zisenye@stu.xidian.edu.cn>

merged into cifs-2.6.git for-next pending additional testing

On Tue, May 5, 2026 at 10:49 PM <zisenye@stu.xidian.edu.cn> wrote:
>
> From: Zisen Ye <zisenye@stu.xidian.edu.cn>
>
> If a server sends a truncated response but a large OutputBufferLength, and
> terminates the EA list early, check_wsl_eas() returns success without
> validating that the entire OutputBufferLength fits within iov_len.
>
> Then smb2_compound_op() does:
>     memcpy(idata->wsl.eas, data[0], size[0]);
>
> Where size[0] is OutputBufferLength. If iov_len is smaller than size[0],
> memcpy can read beyond the end of the rsp_iov allocation and leak adjacent
> kernel heap memory.
>
> Link: https://lore.kernel.org/linux-cifs/d998240c-aca9-420d-9dbd-f5ba24af19e0@chenxiaosong.com/
> Fixes: ea41367b2a60 ("smb: client: introduce SMB2_OP_QUERY_WSL_EA")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zisen Ye <zisenye@stu.xidian.edu.cn>
> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
> ---
>  fs/smb/client/smb2inode.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
> index 286912616c73..6c9c229b91f6 100644
> --- a/fs/smb/client/smb2inode.c
> +++ b/fs/smb/client/smb2inode.c
> @@ -111,7 +111,7 @@ static int check_wsl_eas(struct kvec *rsp_iov)
>         u32 outlen, next;
>         u16 vlen;
>         u8 nlen;
> -       u8 *end;
> +       u8 *ea_end, *iov_end;
>
>         outlen = le32_to_cpu(rsp->OutputBufferLength);
>         if (outlen < SMB2_WSL_MIN_QUERY_EA_RESP_SIZE ||
> @@ -120,15 +120,19 @@ static int check_wsl_eas(struct kvec *rsp_iov)
>
>         ea = (void *)((u8 *)rsp_iov->iov_base +
>                       le16_to_cpu(rsp->OutputBufferOffset));
> -       end = (u8 *)rsp_iov->iov_base + rsp_iov->iov_len;
> +       ea_end = (u8 *)ea + outlen;
> +       iov_end = (u8 *)rsp_iov->iov_base + rsp_iov->iov_len;
> +       if (ea_end > iov_end)
> +               return -EINVAL;
> +
>         for (;;) {
> -               if ((u8 *)ea > end - sizeof(*ea))
> +               if ((u8 *)ea > ea_end - sizeof(*ea))
>                         return -EINVAL;
>
>                 nlen = ea->ea_name_length;
>                 vlen = le16_to_cpu(ea->ea_value_length);
>                 if (nlen != SMB2_WSL_XATTR_NAME_LEN ||
> -                   (u8 *)ea->ea_data + nlen + 1 + vlen > end)
> +                   (u8 *)ea->ea_data + nlen + 1 + vlen > ea_end)
>                         return -EINVAL;
>
>                 switch (vlen) {
> --
> 2.54.0
>


-- 
Thanks,

Steve

      reply	other threads:[~2026-05-06 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06  3:49 [PATCH v4 0/1] smb/client: fix out-of-bounds read zisenye
2026-05-06  3:49 ` [PATCH v4 1/1] smb/client: fix out-of-bounds read in smb2_compound_op() zisenye
2026-05-06 16:03   ` Steve French [this message]

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=CAH2r5msBgZn6QC20gR1p8pMMv-iTKabPbqU78O1MzfW2-1r+JA@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=sprasad@microsoft.com \
    --cc=stable@vger.kernel.org \
    --cc=tom@talpey.com \
    --cc=zisenye@stu.xidian.edu.cn \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).