ksmbd: fix wrong next length validation of ea buffer in smb2_set_ea()
authorNamjae Jeon <linkinjeon@kernel.org>
Sat, 5 Aug 2023 23:44:17 +0000 (08:44 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Aug 2023 16:27:20 +0000 (18:27 +0200)
commitf339d76a3a972601d0738b881b099d49ebbdc3a2
tree1b86d8c0fc1c74a43edc50e27e64929564832f34
parentc6bef3bc30fd4a175aef846b7d928a6c40d091cd
ksmbd: fix wrong next length validation of ea buffer in smb2_set_ea()

commit 79ed288cef201f1f212dfb934bcaac75572fb8f6 upstream.

There are multiple smb2_ea_info buffers in FILE_FULL_EA_INFORMATION request
from client. ksmbd find next smb2_ea_info using ->NextEntryOffset of
current smb2_ea_info. ksmbd need to validate buffer length Before
accessing the next ea. ksmbd should check buffer length using buf_len,
not next variable. next is the start offset of current ea that got from
previous ea.

Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-21598
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/smb/server/smb2pdu.c