hv: check vm state before creating a VM

If launch two UOS with same UUID by acrn-dm, current code path will
return same VM instance to the acrn-dm, this will crash the two UOS.

Check VM state and make sure it's in VM_STATE_INVALID state before
creating a VM.

Tracked-On: #2984
Signed-off-by: Cai Yulong <yulongc@hwtc.com.cn>
This commit is contained in:
Cai Yulong
2019-04-19 15:25:59 +08:00
committed by ACRN System Integration
parent fa47554054
commit 887d41683b
2 changed files with 3 additions and 1 deletions

View File

@@ -308,6 +308,7 @@ static void prepare_sos_vm_memmap(struct acrn_vm *vm)
/**
* @pre vm_id < CONFIG_MAX_VM_NUM && vm_config != NULL && rtn_vm != NULL
* @pre vm->state == VM_STATE_INVALID
*/
int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_vm **rtn_vm)
{