public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: Don't register posted interrupt wakeup handler if alloc_kvm_area() fails
@ 2026-01-13 11:56 Hou Wenlong
  2026-01-13 16:17 ` Sean Christopherson
  2026-01-15 18:03 ` Sean Christopherson
  0 siblings, 2 replies; 5+ messages in thread
From: Hou Wenlong @ 2026-01-13 11:56 UTC (permalink / raw)
  To: kvm
  Cc: Sean Christopherson, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, linux-kernel

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>
---
 arch/x86/kvm/vmx/vmx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 9b92f672ccfe..676f32aa72bb 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -8829,8 +8829,11 @@ __init int vmx_hardware_setup(void)
 	}
 
 	r = alloc_kvm_area();
-	if (r && nested)
-		nested_vmx_hardware_unsetup();
+	if (r) {
+		if (nested)
+			nested_vmx_hardware_unsetup();
+		return r;
+	}
 
 	kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
 

base-commit: f62b64b970570c92fe22503b0cdc65be7ce7fc7c
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-15 18:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13 11:56 [PATCH] KVM: VMX: Don't register posted interrupt wakeup handler if alloc_kvm_area() fails Hou Wenlong
2026-01-13 16:17 ` Sean Christopherson
2026-01-14  3:11   ` Hou Wenlong
2026-01-14 21:22     ` Sean Christopherson
2026-01-15 18:03 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox