Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: yebin <yebin@huaweicloud.com>
To: Steve French <smfrench@gmail.com>, Ye Bin <yebin10@huawei.com>
Cc: sfrench@samba.org, pc@manguebit.com, ronniesahlberg@gmail.com,
	sprasad@microsoft.com, linux-cifs@vger.kernel.org,
	tom@talpey.com, bharathsm@microsoft.com,
	samba-technical@lists.samba.org, chenxiaosong@kylinos.cn
Subject: Re: [PATCH] smb/client: fix possible infinite loop and oob read in symlink_data()
Date: Thu, 14 May 2026 21:25:01 +0800	[thread overview]
Message-ID: <6A05CD2D.6010106@huaweicloud.com> (raw)
In-Reply-To: <CAH2r5mv8X_1QoMHnRg-r1+uLFvH+W-rh+t93Ne1Xj40wFtmShA@mail.gmail.com>

Hi Steve,
I have simplified the patch according to the review comments from Sashiko
and sent the V2 version. Please pay attention to it.


On 2026/5/14 1:58, Steve French wrote:
> merged into cifs-2.6.git for-next
>
> On Wed, May 13, 2026 at 3:15 AM Ye Bin <yebin10@huawei.com> wrote:
>>
>> On 32-bit architectures, the infinite loop is as follows:
>>
>>    len = p->ErrorDataLength == 0xfffffff8
>>    u8 *next = p->ErrorContextData + len
>>    next == p
>>
>> On 32-bit architectures, the out-of-bounds read is as follows:
>>
>>    len = p->ErrorDataLength == 0xfffffff0
>>    u8 *next = p->ErrorContextData + len
>>    next == (u8 *)p - 8
>>
>> Reported-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
>> Fixes: 76894f3e2f71 ("cifs: improve symlink handling for smb2+")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Ye Bin <yebin10@huawei.com>
>> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
>> ---
>>   fs/smb/client/smb2file.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/smb/client/smb2file.c b/fs/smb/client/smb2file.c
>> index b292aa94a593..9d6f342b3f82 100644
>> --- a/fs/smb/client/smb2file.c
>> +++ b/fs/smb/client/smb2file.c
>> @@ -31,7 +31,7 @@ static struct smb2_symlink_err_rsp *symlink_data(const struct kvec *iov)
>>          u32 len;
>>
>>          if (err->ErrorContextCount) {
>> -               struct smb2_error_context_rsp *p;
>> +               struct smb2_error_context_rsp *p, *next;
>>
>>                  len = (u32)err->ErrorContextCount * (offsetof(struct smb2_error_context_rsp,
>>                                                                ErrorContextData) +
>> @@ -49,7 +49,10 @@ static struct smb2_symlink_err_rsp *symlink_data(const struct kvec *iov)
>>                                   __func__, le32_to_cpu(p->ErrorId));
>>
>>                          len = ALIGN(le32_to_cpu(p->ErrorDataLength), 8);
>> -                       p = (struct smb2_error_context_rsp *)(p->ErrorContextData + len);
>> +                       next = (struct smb2_error_context_rsp *)(p->ErrorContextData + len);
>> +                       if (next <= p)
>> +                               return ERR_PTR(-EINVAL);
>> +                       p = next;
>>                  }
>>          } else if (le32_to_cpu(err->ByteCount) >= sizeof(*sym) &&
>>                     iov->iov_len >= SMB2_SYMLINK_STRUCT_SIZE) {
>> --
>> 2.34.1
>>
>>
>
>


      reply	other threads:[~2026-05-14 13:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  8:12 [PATCH] smb/client: fix possible infinite loop and oob read in symlink_data() Ye Bin
2026-05-13 17:58 ` Steve French
2026-05-14 13:25   ` yebin [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=6A05CD2D.6010106@huaweicloud.com \
    --to=yebin@huaweicloud.com \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@kylinos.cn \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    --cc=yebin10@huawei.com \
    /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