ksmbd: Fix buffer length check in fsctl_validate_negotiate_info()
authorMarios Makassikis <mmakassikis@freebox.fr>
Thu, 28 Oct 2021 19:01:27 +0000 (21:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:15 +0000 (19:17 +0100)
commitaacb2ddb67fb3f235ec7582497f870a58962273b
tree916a8932bb804053371f2b33dacc35092094a392
parent5e84e9d61dba1f3f91a979b4e510bdea80ece17e
ksmbd: Fix buffer length check in fsctl_validate_negotiate_info()

commit 78f1688a64cca77758ceb9b183088cf0054bfc82 upstream.

The validate_negotiate_info_req struct definition includes an extra
field to access the data coming after the header. This causes the check
in fsctl_validate_negotiate_info() to count the first element of the
array twice. This in turn makes some valid requests fail, depending on
whether they include padding or not.

Fixes: f7db8fd03a4b ("ksmbd: add validation in smb2_ioctl")
Cc: stable@vger.kernel.org # v5.15
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/smb2pdu.c