Skip to content

Commit 516b3eb

Browse files
Li NanSteve French
authored andcommitted
ksmbd: validate the zero field of packet header
The SMB2 Protocol requires that "The first byte of the Direct TCP transport packet header MUST be zero (0x00)"[1]. Commit 1c1bcf2 ("ksmbd: validate smb request protocol id") removed the validation of this 1-byte zero. Add the validation back now. [1]: [MS-SMB2] - v20230227, page 30. https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-SMB2/%5bMS-SMB2%5d-230227.pdf Fixes: 1c1bcf2 ("ksmbd: validate smb request protocol id") Signed-off-by: Li Nan <linan122@huawei.com> Acked-by: Tom Talpey <tom@talpey.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 0dd3ee3 commit 516b3eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/smb/server/smb_common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,12 @@ int ksmbd_verify_smb_message(struct ksmbd_work *work)
158158
*/
159159
bool ksmbd_smb_request(struct ksmbd_conn *conn)
160160
{
161-
__le32 *proto = (__le32 *)smb2_get_msg(conn->request_buf);
161+
__le32 *proto;
162162

163+
if (conn->request_buf[0] != 0)
164+
return false;
165+
166+
proto = (__le32 *)smb2_get_msg(conn->request_buf);
163167
if (*proto == SMB2_COMPRESSION_TRANSFORM_ID) {
164168
pr_err_ratelimited("smb2 compression not support yet");
165169
return false;

0 commit comments

Comments
 (0)