Commit 3b9c30eb authored by ChenXiaoSong's avatar ChenXiaoSong Committed by Steve French
Browse files

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: 83bfbd0b ("cifs: Remove the RFC1002 header from smb_hdr")
Suggested-by: default avatarDavid Howells <dhowells@redhat.com>
Suggested-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 0b444cfd
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -295,7 +295,8 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn)
	return true;
}

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

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

		if (pdu_size < SMB1_MIN_SUPPORTED_HEADER_SIZE)
		if (pdu_size < SMB1_MIN_SUPPORTED_PDU_SIZE)
			break;

		/* 4 for rfc1002 length field */