OSDN Git Service

ksmbd: add validation for FILE_FULL_EA_INFORMATION of smb2_get_info
authorNamjae Jeon <linkinjeon@kernel.org>
Sat, 18 Sep 2021 09:45:12 +0000 (18:45 +0900)
committerSteve French <stfrench@microsoft.com>
Sat, 18 Sep 2021 15:51:38 +0000 (10:51 -0500)
Add validation to check whether req->InputBufferLength is smaller than
smb2_ea_info_req structure size.

Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Ralph Böhme <slow@samba.org>
Cc: Steve French <smfrench@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/smb2pdu.c

index 46e0275..6304c9b 100644 (file)
@@ -4045,6 +4045,10 @@ static int smb2_get_ea(struct ksmbd_work *work, struct ksmbd_file *fp,
        path = &fp->filp->f_path;
        /* single EA entry is requested with given user.* name */
        if (req->InputBufferLength) {
+               if (le32_to_cpu(req->InputBufferLength) <
+                   sizeof(struct smb2_ea_info_req))
+                       return -EINVAL;
+
                ea_req = (struct smb2_ea_info_req *)req->Buffer;
        } else {
                /* need to send all EAs, if no specific EA is requested*/