mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-03 09:23:35 +00:00
HV: fix potential NULL function pointer reference
- 'dispatch' will be null and be referenced if 'basic_exit_reason < ARRAY_SIZE(dispatch_table)' if false. Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
parent
8e45c663e4
commit
2b69329ec7
@ -191,7 +191,12 @@ int vmexit_handler(struct vcpu *vcpu)
|
||||
pr_dbg("Exit Reason: 0x%016llx ", vcpu->arch_vcpu.exit_reason);
|
||||
|
||||
/* Ensure exit reason is within dispatch table */
|
||||
if (basic_exit_reason < ARRAY_SIZE(dispatch_table)) {
|
||||
if (basic_exit_reason >= ARRAY_SIZE(dispatch_table)) {
|
||||
pr_err("Invalid Exit Reason: 0x%016llx ",
|
||||
vcpu->arch_vcpu.exit_reason);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Calculate dispatch table entry */
|
||||
dispatch = (struct vm_exit_dispatch *)
|
||||
(dispatch_table + basic_exit_reason);
|
||||
@ -204,7 +209,6 @@ int vmexit_handler(struct vcpu *vcpu)
|
||||
vcpu->arch_vcpu.exit_qualification =
|
||||
exec_vmread(VMX_EXIT_QUALIFICATION);
|
||||
}
|
||||
}
|
||||
|
||||
/* Update current vcpu in VM that caused vm exit */
|
||||
vcpu->vm->current_vcpu = vcpu;
|
||||
|
Loading…
Reference in New Issue
Block a user