mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-04 01:41:08 +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,19 +191,23 @@ int vmexit_handler(struct vcpu *vcpu)
|
|||||||
pr_dbg("Exit Reason: 0x%016llx ", vcpu->arch_vcpu.exit_reason);
|
pr_dbg("Exit Reason: 0x%016llx ", vcpu->arch_vcpu.exit_reason);
|
||||||
|
|
||||||
/* Ensure exit reason is within dispatch table */
|
/* Ensure exit reason is within dispatch table */
|
||||||
if (basic_exit_reason < ARRAY_SIZE(dispatch_table)) {
|
if (basic_exit_reason >= ARRAY_SIZE(dispatch_table)) {
|
||||||
/* Calculate dispatch table entry */
|
pr_err("Invalid Exit Reason: 0x%016llx ",
|
||||||
dispatch = (struct vm_exit_dispatch *)
|
vcpu->arch_vcpu.exit_reason);
|
||||||
(dispatch_table + basic_exit_reason);
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* See if an exit qualification is necessary for this exit
|
/* Calculate dispatch table entry */
|
||||||
* handler
|
dispatch = (struct vm_exit_dispatch *)
|
||||||
*/
|
(dispatch_table + basic_exit_reason);
|
||||||
if (dispatch->need_exit_qualification) {
|
|
||||||
/* Get exit qualification */
|
/* See if an exit qualification is necessary for this exit
|
||||||
vcpu->arch_vcpu.exit_qualification =
|
* handler
|
||||||
exec_vmread(VMX_EXIT_QUALIFICATION);
|
*/
|
||||||
}
|
if (dispatch->need_exit_qualification) {
|
||||||
|
/* Get exit qualification */
|
||||||
|
vcpu->arch_vcpu.exit_qualification =
|
||||||
|
exec_vmread(VMX_EXIT_QUALIFICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update current vcpu in VM that caused vm exit */
|
/* Update current vcpu in VM that caused vm exit */
|
||||||
|
Loading…
Reference in New Issue
Block a user