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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Feb 2024 00:18:48 +0000 (16:18 -0800)
commit38298acb7899b119f9643c8d7db00b126a72a0d5
tree0a5833a3f21c2a636df8e783b934007e14f5ed12
parent5157319fc52e06b6d2082ab28083d9325760c56e
smb: client: fix parsing of SMB3.1.1 POSIX create context

[ Upstream commit 76025cc2285d9ede3d717fe4305d66f8be2d9346 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/smb2pdu.c