summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenXiaoSong <chenxiaosong@kylinos.cn>2025-12-20 16:25:50 +0300
committerSteve French <stfrench@microsoft.com>2025-12-22 04:20:46 +0300
commit3b9c30eb8f5aaad4a54cdfa470b74c0467cc71e8 (patch)
treee23527d99a1a413829859920ea697e05e5ffd4f7
parent0b444cfd8b74ebce421ccd96eac9c495e536c92e (diff)
downloadlinux-3b9c30eb8f5aaad4a54cdfa470b74c0467cc71e8.tar.xz
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: 83bfbd0bb902 ("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>
-rw-r--r--fs/smb/server/connection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/smb/server/connection.c b/fs/smb/server/connection.c
index b2afd8a43b0a..487b5562c771 100644
--- a/fs/smb/server/connection.c
+++ b/fs/smb/server/connection.c
@@ -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 @@ recheck:
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 */