]> git.itanic.dy.fi Git - linux-stable/commitdiff
smb: client: fix parsing of SMB3.1.1 POSIX create context
authorPaulo Alcantara <pc@manguebit.com>
Fri, 19 Jan 2024 04:08:26 +0000 (01:08 -0300)
committerSteve French <stfrench@microsoft.com>
Fri, 19 Jan 2024 16:30:51 +0000 (10:30 -0600)
The data offset for the SMB3.1.1 POSIX create context will always be
8-byte aligned so having the check 'noff + nlen >= doff' in
smb2_parse_contexts() is wrong as it will lead to -EINVAL because noff
+ nlen == doff.

Fix the sanity check to correctly handle aligned create context data.

Fixes: af1689a9b770 ("smb: client: fix potential OOBs in smb2_parse_contexts()")
Signed-off-by: Paulo Alcantara <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2pdu.c

index f8d70660ba2926f736e92fbb682df8331799048e..ec39dfbc315417fafd189d8dc3fc5c44e3d6a993 100644 (file)
@@ -2277,7 +2277,7 @@ int smb2_parse_contexts(struct TCP_Server_Info *server,
 
                noff = le16_to_cpu(cc->NameOffset);
                nlen = le16_to_cpu(cc->NameLength);
-               if (noff + nlen >= doff)
+               if (noff + nlen > doff)
                        return -EINVAL;
 
                name = (char *)cc + noff;