Skip to content

Commit 3b9c30e

Browse files
ChenXiaoSongsmfrench
authored andcommitted
smb/server: fix minimum SMB1 PDU size
Since the RFC1002 header has been removed from `struct smb_hdr`, the minimum SMB1 PDU size should be updated as well. Fixes: 83bfbd0 ("cifs: Remove the RFC1002 header from smb_hdr") Suggested-by: David Howells <dhowells@redhat.com> Suggested-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Reviewed-by: David Howells <dhowells@redhat.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 0b444cf commit 3b9c30e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/smb/server/connection.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn)
295295
return true;
296296
}
297297

298-
#define SMB1_MIN_SUPPORTED_HEADER_SIZE (sizeof(struct smb_hdr))
298+
/* "+2" for BCC field (ByteCount, 2 bytes) */
299+
#define SMB1_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb_hdr) + 2)
299300
#define SMB2_MIN_SUPPORTED_HEADER_SIZE (sizeof(struct smb2_hdr) + 4)
300301

301302
/**
@@ -363,7 +364,7 @@ int ksmbd_conn_handler_loop(void *p)
363364
if (pdu_size > MAX_STREAM_PROT_LEN)
364365
break;
365366

366-
if (pdu_size < SMB1_MIN_SUPPORTED_HEADER_SIZE)
367+
if (pdu_size < SMB1_MIN_SUPPORTED_PDU_SIZE)
367368
break;
368369

369370
/* 4 for rfc1002 length field */

0 commit comments

Comments
 (0)