ksmbd: move credit charge verification over smb2 request size verification

Move credit charge verification over smb2 request size verification
to avoid being skipped.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Namjae Jeon 2021-07-16 16:39:54 +09:00
parent 67307023d0
commit d347d745f0

View File

@ -385,6 +385,12 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
}
}
if ((work->conn->vals->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU) &&
smb2_validate_credit_charge(hdr)) {
work->conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
return 1;
}
clc_len = smb2_calc_size(hdr);
if (len != clc_len) {
/* server can return one byte more due to implied bcc[0] */
@ -423,12 +429,6 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
return 1;
}
if ((work->conn->vals->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU) &&
smb2_validate_credit_charge(hdr)) {
work->conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
return 1;
}
return 0;
}