cifs: fix negotiate context parsing
authorDavid Disseldorp <ddiss@suse.de>
Thu, 6 Apr 2023 22:34:11 +0000 (00:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:35:14 +0000 (12:35 +0200)
commitf4523cd4986fb2c4dae63ff642f57e7be1b6ade2
treefd07f9d1c895b47887b9e93c1d47133948d6c45f
parent8f09ece19c22a2fbb5df32ed8392d2fff5dcc45e
cifs: fix negotiate context parsing

[ Upstream commit 5105a7ffce19160e7062aee67fb6b3b8a1b56d78 ]

smb311_decode_neg_context() doesn't properly check against SMB packet
boundaries prior to accessing individual negotiate context entries. This
is due to the length check omitting the eight byte smb2_neg_context
header, as well as incorrect decrementing of len_of_ctxts.

Fixes: 5100d8a3fe03 ("SMB311: Improve checking of negotiate security contexts")
Reported-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/smb2pdu.c