Skip to content

Commit 6b1ca26

Browse files
committed
KVM: x86: clarify leave_smm() return value
The return value of vmx_leave_smm() is unrelated from that of nested_vmx_enter_non_root_mode(). Check explicitly for success (which happens to be 0) and return 1 just like everywhere else in vmx_leave_smm(). Likewise, in svm_leave_smm() return 0/1 instead of the 0/1/-errno returned by tenter_svm_guest_mode(). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 3e74569 commit 6b1ca26

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

arch/x86/kvm/svm/svm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4884,11 +4884,11 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
48844884
if (nested_svm_check_cached_vmcb12(vcpu) < 0)
48854885
goto unmap_save;
48864886

4887-
ret = enter_svm_guest_mode(vcpu, smram64->svm_guest_vmcb_gpa, vmcb12, false);
4888-
4889-
if (ret)
4887+
if (enter_svm_guest_mode(vcpu, smram64->svm_guest_vmcb_gpa,
4888+
vmcb12, false) != 0)
48904889
goto unmap_save;
48914890

4891+
ret = 0;
48924892
svm->nested.nested_run_pending = 1;
48934893

48944894
unmap_save:

arch/x86/kvm/vmx/vmx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8533,8 +8533,8 @@ int vmx_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
85338533
return 1;
85348534

85358535
ret = nested_vmx_enter_non_root_mode(vcpu, false);
8536-
if (ret)
8537-
return ret;
8536+
if (ret != NVMX_VMENTRY_SUCCESS)
8537+
return 1;
85388538

85398539
vmx->nested.nested_run_pending = 1;
85408540
vmx->nested.smm.guest_mode = false;

0 commit comments

Comments
 (0)