ksmbd: validate length in smb2_write()
authorMarios Makassikis <mmakassikis@freebox.fr>
Wed, 4 May 2022 13:40:10 +0000 (15:40 +0200)
committerSteve French <stfrench@microsoft.com>
Tue, 10 May 2022 03:23:01 +0000 (22:23 -0500)
commit158a66b245739e15858de42c0ba60fcf3de9b8e6
treea6ff034adb6b5418e71b4eadfd9e854ac9763695
parentd21a580dafc69aa04f46e6099616146a536b0724
ksmbd: validate length in smb2_write()

The SMB2 Write packet contains data that is to be written
to a file or to a pipe. Depending on the client, there may
be padding between the header and the data field.
Currently, the length is validated only in the case padding
is present.

Since the DataOffset field always points to the beginning
of the data, there is no need to have a special case for
padding. By removing this, the length is validated in both
cases.

Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/smb2pdu.c