]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: x86: clarify leave_smm() return value
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 10 Mar 2026 19:33:39 +0000 (20:33 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 11 Mar 2026 17:41:12 +0000 (18:41 +0100)
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>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c

index 4eb2c36b8ff21783f935f85edf093a473428921a..e6477affac9a049d841b561bb11099afbbd1c6e0 100644 (file)
@@ -4884,11 +4884,11 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
        if (nested_svm_check_cached_vmcb12(vcpu) < 0)
                goto unmap_save;
 
-       ret = enter_svm_guest_mode(vcpu, smram64->svm_guest_vmcb_gpa, vmcb12, false);
-
-       if (ret)
+       if (enter_svm_guest_mode(vcpu, smram64->svm_guest_vmcb_gpa,
+                                vmcb12, false) != 0)
                goto unmap_save;
 
+       ret = 0;
        svm->nested.nested_run_pending = 1;
 
 unmap_save:
index bccc91a999d9f4c3aa427291b2143cf5bfd1a520..8b24e682535bf8cc96b2c935062df63caf8c208c 100644 (file)
@@ -8533,8 +8533,8 @@ int vmx_leave_smm(struct kvm_vcpu *vcpu, const union kvm_smram *smram)
                        return 1;
 
                ret = nested_vmx_enter_non_root_mode(vcpu, false);
-               if (ret)
-                       return ret;
+               if (ret != NVMX_VMENTRY_SUCCESS)
+                       return 1;
 
                vmx->nested.nested_run_pending = 1;
                vmx->nested.smm.guest_mode = false;