]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cifs: Fix validation of SMB1 query reparse point response
authorPali Rohár <pali@kernel.org>
Thu, 26 Dec 2024 18:55:13 +0000 (19:55 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 2 Jun 2025 01:43:57 +0000 (20:43 -0500)
commit56e84c64fc257a95728ee73165456b025c48d408
treeae8006b5af1d894f4e2ffeeb8303fba5d411586e
parent89381c72d52094988e11d23ef24a00066a0fa458
cifs: Fix validation of SMB1 query reparse point response

Validate the SMB1 query reparse point response per [MS-CIFS] section
2.2.7.2 NT_TRANSACT_IOCTL.

NT_TRANSACT_IOCTL response contains one word long setup data after which is
ByteCount member. So check that SetupCount is 1 before trying to read and
use ByteCount member.

Output setup data contains ReturnedDataLen member which is the output
length of executed IOCTL command by remote system. So check that output was
not truncated before transferring over network.

Change MaxSetupCount of NT_TRANSACT_IOCTL request from 4 to 1 as io_rsp
structure already expects one word long output setup data. This should
prevent server sending incompatible structure (in case it would be extended
in future, which is unlikely).

Change MaxParameterCount of NT_TRANSACT_IOCTL request from 2 to 0 as
NT IOCTL does not have any documented output parameters and this function
does not parse any output parameters at all.

Fixes: ed3e0a149b58 ("smb: client: implement ->query_reparse_point() for SMB1")
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifssmb.c