Skip to content

Commit a738968

Browse files
Sainath Grandhiacrnsi
authored andcommitted
hv: Precondition checks for vcpu_from_vid for lapic passthrough ICR access
Since the vapic_id is from VM, need to check for pre-condition before passing vcpu_id to vcpu_from_vid. This is in the path of LAPIC passthrough ICR access Tracked-On: #3170 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent 7f648d7 commit a738968

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,9 +2018,9 @@ vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
20182018
ret = -1;
20192019
} else {
20202020
vcpu_id = vm_apicid2vcpu_id(vm, vapic_id);
2021-
target_vcpu = vcpu_from_vid(vm, vcpu_id);
2021+
if ((vcpu_id < vm->hw.created_vcpus) && (vm->hw.vcpu_array[vcpu_id].state != VCPU_OFFLINE)) {
2022+
target_vcpu = vcpu_from_vid(vm, vcpu_id);
20222023

2023-
if (target_vcpu != NULL) {
20242024
switch (mode) {
20252025
case APIC_DELMODE_INIT:
20262026
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);

0 commit comments

Comments
 (0)