[Bug,206579] KVM with passthrough generates "BUG: kernel NULL pointer dereference" and crashes
diff mbox series

Message ID bug-206579-28872-lDJ9nWA50q@https.bugzilla.kernel.org/
State New
Headers show
Series
  • [Bug,206579] KVM with passthrough generates "BUG: kernel NULL pointer dereference" and crashes
Related show

Commit Message

bugzilla-daemon@bugzilla.kernel.org March 1, 2020, 6:21 p.m. UTC
https://bugzilla.kernel.org/show_bug.cgi?id=206579

--- Comment #43 from Paolo Bonzini (bonzini@gnu.org) ---
Hey, this should fix the warning (not sure because it's untested and I'd wait
for Suravee to confirm it's the intended behavior):

                avic_vcpu_load(vcpu, vcpu->cpu);

Patch
diff mbox series

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index b51b362a9736..81c2cfa96b69 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2162,6 +2162,9 @@  static void avic_set_running(struct kvm_vcpu *vcpu, bool
is_run)
 {
        struct vcpu_svm *svm = to_svm(vcpu);

+       if (svm->avic_is_running == is_run)
+               return;
+
        svm->avic_is_running = is_run;
        if (is_run)