diff --git a/hypervisor/arch/x86/guest/vcpu.c b/hypervisor/arch/x86/guest/vcpu.c index af6be8638..7dfdf2163 100644 --- a/hypervisor/arch/x86/guest/vcpu.c +++ b/hypervisor/arch/x86/guest/vcpu.c @@ -326,6 +326,7 @@ int create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn_vcp */ vcpu_id = atomic_xadd16(&vm->hw.created_vcpus, 1U); if (vcpu_id >= CONFIG_MAX_VCPUS_PER_VM) { + vm->hw.created_vcpus--; pr_err("%s, vcpu id is invalid!\n", __func__); return -EINVAL; }