Skip to content

Commit 6c8512a

Browse files
bysuisean-jc
authored andcommitted
KVM: VMX: Don't register posted interrupt wakeup handler if alloc_kvm_area() fails
Unregistering the posted interrupt wakeup handler only happens during hardware unsetup. Therefore, if alloc_kvm_area() fails and continue to register the posted interrupt wakeup handler, this will leave the global posted interrupt wakeup handler pointer in an incorrect state. Although it should not be an issue, it's still better to change it. Signed-off-by: Hou Wenlong <houwenlong.hwl@antgroup.com> Fixes: ec5a491 ("KVM: VMX: Unregister posted interrupt wakeup handler on hardware unsetup") Link: https://patch.msgid.link/0ac6908b608cf80eab7437004334fedd0f5f5317.1768304590.git.houwenlong.hwl@antgroup.com [sean: use a goto] Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent ff8071e commit 6c8512a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

arch/x86/kvm/vmx/vmx.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8708,8 +8708,8 @@ __init int vmx_hardware_setup(void)
87088708
}
87098709

87108710
r = alloc_kvm_area();
8711-
if (r && nested)
8712-
nested_vmx_hardware_unsetup();
8711+
if (r)
8712+
goto err_kvm_area;
87138713

87148714
kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
87158715

@@ -8736,6 +8736,11 @@ __init int vmx_hardware_setup(void)
87368736

87378737
kvm_caps.inapplicable_quirks &= ~KVM_X86_QUIRK_IGNORE_GUEST_PAT;
87388738

8739+
return 0;
8740+
8741+
err_kvm_area:
8742+
if (nested)
8743+
nested_vmx_hardware_unsetup();
87398744
return r;
87408745
}
87418746

0 commit comments

Comments
 (0)