mcctrl_getrusage: validate os input

Change-Id: I97908069f8bc4703b99f9ffca94f3dd33eb64cc4
This commit is contained in:
tinhnt86
2020-10-08 16:46:43 +07:00
committed by Masamichi Takagi
parent 550c6cc5fb
commit fe5d8fc71f

View File

@ -2481,6 +2481,10 @@ long mcctrl_getrusage(ihk_os_t ihk_os, struct mcctrl_ioctl_getrusage_desc *__use
unsigned long ut;
unsigned long st;
if (!ihk_os || ihk_host_validate_os(ihk_os)) {
return -EINVAL;
}
ret = copy_from_user(&desc, _desc, sizeof(struct mcctrl_ioctl_getrusage_desc));
if (ret != 0) {
printk("%s: copy_from_user failed\n", __FUNCTION__);