From: ChenXiaoSong <chenxiaosong.chenxiaosong@linux.dev>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: dhowells@redhat.com, sfrench@samba.org, smfrench@gmail.com,
linkinjeon@samba.org, pc@manguebit.org, ronniesahlberg@gmail.com,
sprasad@microsoft.com, tom@talpey.com, bharathsm@microsoft.com,
senozhatsky@chromium.org, linux-cifs@vger.kernel.org,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: Re: [PATCH] smb/server: fix SMB2_MIN_SUPPORTED_HEADER_SIZE value
Date: Fri, 19 Dec 2025 08:59:36 +0800 [thread overview]
Message-ID: <9b5eec32-d702-4d77-b4dd-5c33939ae6e2@linux.dev> (raw)
In-Reply-To: <CAKYAXd-W9xN9rQ4_Y9eudV2CJ7ZObys9YLXib-=wHymH4kfExg@mail.gmail.com>
Hi Namjae,
We should rename them to `SMB1_MIN_SUPPORTED_PDU_SIZE` and
`SMB2_MIN_SUPPORTED_PDU_SIZE`.
But we "should not" add "+4" to them.
The `ksmbd_conn_handler_loop()` function is as follows:
ksmbd_conn_handler_loop()
{
...
pdu_size = get_rfc1002_len(hdr_buf);
...
if (pdu_size < SMB1_MIN_SUPPORTED_HEADER_SIZE)
...
if (pdu_size < SMB2_MIN_SUPPORTED_HEADER_SIZE)
...
}
Thanks,
ChenXiaoSong.
On 12/19/25 08:16, Namjae Jeon wrote:
> On Fri, Dec 19, 2025 at 2:11 AM <chenxiaosong.chenxiaosong@linux.dev> wrote:
>>
>> From: ChenXiaoSong <chenxiaosong@kylinos.cn>
>>
>> See RFC1002 4.3.1.
>>
>> The LENGTH field is the number of bytes following the LENGTH
>> field. In other words, LENGTH is the combined size of the
>> TRAILER field(s).
>>
>> Link: https://lore.kernel.org/linux-cifs/e4fbcbad-459a-412c-918c-0279ec890353@linux.dev/
>> Reported-by: David Howells <dhowells@redhat.com>
>> Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
>> ---
>> fs/smb/server/connection.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/smb/server/connection.c b/fs/smb/server/connection.c
>> index b6b4f1286b9c..da6dfd0d80c2 100644
>> --- a/fs/smb/server/connection.c
>> +++ b/fs/smb/server/connection.c
>> @@ -296,7 +296,7 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn)
>> }
>>
>> #define SMB1_MIN_SUPPORTED_HEADER_SIZE (sizeof(struct smb_hdr))
>> -#define SMB2_MIN_SUPPORTED_HEADER_SIZE (sizeof(struct smb2_hdr) + 4)
>> +#define SMB2_MIN_SUPPORTED_HEADER_SIZE (sizeof(struct smb2_hdr))
> +4 is needed to validate the ByteCount field of the smb1 request and
> the StructureSize2 field of the smb2 request. Let's change the macro
> name from HEADER_SIZE to PDU_SIZE and add +4 to
> SMB1_MIN_SUPPORTED_PDU_SIZE.
>>
>> /**
>> * ksmbd_conn_handler_loop() - session thread to listen on new smb requests
>> --
>> 2.43.0
>>
next prev parent reply other threads:[~2025-12-19 1:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 17:10 [PATCH] smb/server: fix SMB2_MIN_SUPPORTED_HEADER_SIZE value chenxiaosong.chenxiaosong
2025-12-19 0:16 ` Namjae Jeon
2025-12-19 0:59 ` ChenXiaoSong [this message]
2025-12-19 1:16 ` Namjae Jeon
2025-12-19 1:30 ` ChenXiaoSong
2025-12-19 1:42 ` Namjae Jeon
2025-12-19 1:45 ` ChenXiaoSong
2025-12-19 8:17 ` David Howells
2025-12-19 10:32 ` Namjae Jeon
2025-12-19 10:42 ` ChenXiaoSong
2025-12-19 10:50 ` David Howells
2025-12-19 11:52 ` Namjae Jeon
2025-12-19 13:53 ` ChenXiaoSong
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=9b5eec32-d702-4d77-b4dd-5c33939ae6e2@linux.dev \
--to=chenxiaosong.chenxiaosong@linux.dev \
--cc=bharathsm@microsoft.com \
--cc=chenxiaosong@kylinos.cn \
--cc=dhowells@redhat.com \
--cc=linkinjeon@kernel.org \
--cc=linkinjeon@samba.org \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@manguebit.org \
--cc=ronniesahlberg@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=sfrench@samba.org \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.