mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ksmbd: fix wrong next length validation of ea buffer in smb2_set_ea()
commit 79ed288cef 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c6bef3bc30
commit
f339d76a3a
@@ -2340,9 +2340,16 @@ next:
|
|||||||
break;
|
break;
|
||||||
buf_len -= next;
|
buf_len -= next;
|
||||||
eabuf = (struct smb2_ea_info *)((char *)eabuf + next);
|
eabuf = (struct smb2_ea_info *)((char *)eabuf + next);
|
||||||
if (next < (u32)eabuf->EaNameLength + le16_to_cpu(eabuf->EaValueLength))
|
if (buf_len < sizeof(struct smb2_ea_info)) {
|
||||||
|
rc = -EINVAL;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf_len < sizeof(struct smb2_ea_info) + eabuf->EaNameLength +
|
||||||
|
le16_to_cpu(eabuf->EaValueLength)) {
|
||||||
|
rc = -EINVAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (next != 0);
|
} while (next != 0);
|
||||||
|
|
||||||
kfree(attr_name);
|
kfree(attr_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user