Skip to content

Commit ec5a491

Browse files
sean-jcbonzini
authored andcommitted
KVM: VMX: Unregister posted interrupt wakeup handler on hardware unsetup
Unregister KVM's posted interrupt wakeup handler during unsetup so that a spurious interrupt that arrives after kvm_intel.ko is unloaded doesn't call into freed memory. Fixes: bf9f6ac ("KVM: Update Posted-Interrupts Descriptor when vCPU is blocked") Cc: [email protected] Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 6ff53f6 commit ec5a491

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7555,6 +7555,8 @@ static void vmx_migrate_timers(struct kvm_vcpu *vcpu)
75557555

75567556
static void hardware_unsetup(void)
75577557
{
7558+
kvm_set_posted_intr_wakeup_handler(NULL);
7559+
75587560
if (nested)
75597561
nested_vmx_hardware_unsetup();
75607562

@@ -7885,8 +7887,6 @@ static __init int hardware_setup(void)
78857887
vmx_x86_ops.request_immediate_exit = __kvm_request_immediate_exit;
78867888
}
78877889

7888-
kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
7889-
78907890
kvm_mce_cap_supported |= MCG_LMCE_P;
78917891

78927892
if (pt_mode != PT_MODE_SYSTEM && pt_mode != PT_MODE_HOST_GUEST)
@@ -7910,6 +7910,9 @@ static __init int hardware_setup(void)
79107910
r = alloc_kvm_area();
79117911
if (r)
79127912
nested_vmx_hardware_unsetup();
7913+
7914+
kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
7915+
79137916
return r;
79147917
}
79157918

0 commit comments

Comments
 (0)