smb3: check xattr value length earlier
authorSteve French <stfrench@microsoft.com>
Tue, 12 Jul 2022 16:43:44 +0000 (11:43 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:11:37 +0000 (11:11 +0200)
commitb8ba8e22c5134f648f6f9f33f82c70ab6d710199
treed4a9bfc2f1e8d980bd608d383282c053d2b44309
parent7725d8158ca9377057e01fd44b2d429dbd2a812e
smb3: check xattr value length earlier

[ Upstream commit 5fa2cffba0b82336a2244d941322eb1627ff787b ]

Coverity complains about assigning a pointer based on
value length before checking that value length goes
beyond the end of the SMB.  Although this is even more
unlikely as value length is a single byte, and the
pointer is not dereferenced until laterm, it is clearer
to check the lengths first.

Addresses-Coverity: 1467704 ("Speculative execution data leak")
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/smb2ops.c