]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message
authorZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Mon, 26 Sep 2022 03:36:29 +0000 (11:36 +0800)
committerSteve French <stfrench@microsoft.com>
Wed, 5 Oct 2022 06:28:55 +0000 (01:28 -0500)
Commit 9b9e5f4e392f ("smb3: add smb3.1.1 to default dialect list")
extend the dialects from 3 to 4, but forget to decrease the extended
length when specific the dialect, then the message length is larger
than expected.

This maybe leak some info through network because not initialize the
message body.

After apply this patch, the VALIDATE_NEGOTIATE_INFO message length is
reduced from 28 bytes to 26 bytes.

Fixes: 9b9e5f4e392f ("smb3: add smb3.1.1 to default dialect list")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Cc: <stable@vger.kernel.org>
Acked-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Tom Talpey <tom@talpey.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2pdu.c

index 6352ab32c7e7ab7004fa94e75e42bb9897384d1c..223056097b54f855ce57f552927fb1d91844d495 100644 (file)
@@ -1169,9 +1169,9 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
                pneg_inbuf->Dialects[0] =
                        cpu_to_le16(server->vals->protocol_id);
                pneg_inbuf->DialectCount = cpu_to_le16(1);
-               /* structure is big enough for 3 dialects, sending only 1 */
+               /* structure is big enough for 4 dialects, sending only 1 */
                inbuflen = sizeof(*pneg_inbuf) -
-                               sizeof(pneg_inbuf->Dialects[0]) * 2;
+                               sizeof(pneg_inbuf->Dialects[0]) * 3;
        }
 
        rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,