mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
hv: fix possible inconsistent issue for 'vm->hw.create_vcpus'
to decrease the value of 'create_vcpus' in fail case. Tracked-On: #861 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
7bb09f75da
commit
b3b24320d4
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user