Commit 4c7d8eb9 authored by ChenXiaoSong's avatar ChenXiaoSong Committed by Steve French
Browse files

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: 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 3b9c30eb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn)

/* "+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)
#define SMB2_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb2_pdu))

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

		if (((struct smb2_hdr *)smb_get_msg(conn->request_buf))->ProtocolId ==
		    SMB2_PROTO_NUMBER) {
			if (pdu_size < SMB2_MIN_SUPPORTED_HEADER_SIZE)
			if (pdu_size < SMB2_MIN_SUPPORTED_PDU_SIZE)
				break;
		}