mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-04 23:24:56 +00:00
HV: check vm id param when dispatching hypercall
If the vmcall param passed from guest is representing a vmid, we should make sure it is a valid one because it is a pre-condition of following get_vm_from_vmid(). And then we don't need to do NULL VM pointer check in is_valid_vm() because get_vm_from_vmid() would never return NULL. Tracked-On: #2978 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -428,11 +428,11 @@ struct acrn_vuart *vuart_console_active(void)
|
||||
|
||||
if (console_vmid < CONFIG_MAX_VM_NUM) {
|
||||
vm = get_vm_from_vmid(console_vmid);
|
||||
if (is_valid_vm(vm)) {
|
||||
vu = vm_console_vuart(vm);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_valid_vm(vm)) {
|
||||
vu = vm_console_vuart(vm);
|
||||
}
|
||||
return (vu && vu->active) ? vu : NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user