mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state
Move call to nested_enable_evmcs until after free_nested() is complete. Signed-off-by: Aaron Lewis <aaronlewis@google.com> Reviewed-by: Marc Orr <marcorr@google.com> Reviewed-by: Peter Shier <pshier@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									4b350aebbe
								
							
						
					
					
						commit
						332d079735
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -5333,9 +5333,6 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
 | 
			
		|||
	if (kvm_state->format != 0)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
 | 
			
		||||
	if (kvm_state->flags & KVM_STATE_NESTED_EVMCS)
 | 
			
		||||
		nested_enable_evmcs(vcpu, NULL);
 | 
			
		||||
 | 
			
		||||
	if (!nested_vmx_allowed(vcpu))
 | 
			
		||||
		return kvm_state->vmx.vmxon_pa == -1ull ? 0 : -EINVAL;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -5377,6 +5374,9 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
 | 
			
		|||
	if (kvm_state->vmx.vmxon_pa == -1ull)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (kvm_state->flags & KVM_STATE_NESTED_EVMCS)
 | 
			
		||||
		nested_enable_evmcs(vcpu, NULL);
 | 
			
		||||
 | 
			
		||||
	vmx->nested.vmxon_ptr = kvm_state->vmx.vmxon_pa;
 | 
			
		||||
	ret = enter_vmx_operation(vcpu);
 | 
			
		||||
	if (ret)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue