Skip to content

Commit 4c7d8eb

Browse files
ChenXiaoSongsmfrench
authored andcommitted
smb/server: fix minimum SMB2 PDU size
The minimum SMB2 PDU size should be updated to the size of `struct smb2_pdu` (that is, the size of `struct smb2_hdr` + 2). 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 3b9c30e commit 4c7d8eb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/smb/server/connection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn)
297297

298298
/* "+2" for BCC field (ByteCount, 2 bytes) */
299299
#define SMB1_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb_hdr) + 2)
300-
#define SMB2_MIN_SUPPORTED_HEADER_SIZE (sizeof(struct smb2_hdr) + 4)
300+
#define SMB2_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb2_pdu))
301301

302302
/**
303303
* ksmbd_conn_handler_loop() - session thread to listen on new smb requests
@@ -397,7 +397,7 @@ int ksmbd_conn_handler_loop(void *p)
397397

398398
if (((struct smb2_hdr *)smb_get_msg(conn->request_buf))->ProtocolId ==
399399
SMB2_PROTO_NUMBER) {
400-
if (pdu_size < SMB2_MIN_SUPPORTED_HEADER_SIZE)
400+
if (pdu_size < SMB2_MIN_SUPPORTED_PDU_SIZE)
401401
break;
402402
}
403403

0 commit comments

Comments
 (0)