hv: vmcall: check vm id in dispatch_sos_hypercall

Check whether vm_id is valid in dispatch_sos_hypercall

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
Li Fei1
2020-07-21 10:28:00 +08:00
committed by wenlingz
parent 1859727abc
commit 5e605e0daf
5 changed files with 45 additions and 45 deletions

View File

@@ -93,6 +93,10 @@ bool is_postlaunched_vm(const struct acrn_vm *vm)
return (get_vm_config(vm->vm_id)->load_order == POST_LAUNCHED_VM);
}
bool is_valid_postlaunched_vmid(uint16_t vm_id)
{
return ((vm_id < CONFIG_MAX_VM_NUM) && is_postlaunched_vm(get_vm_from_vmid(vm_id)));
}
/**
* @pre vm != NULL
* @pre vm->vmid < CONFIG_MAX_VM_NUM