KVM: x86: hyper-v: Fix Hyper-V context null-ptr-deref
[linux-2.6-microblaze.git] / arch / x86 / kvm / hyperv.c
index 7d2dae9..58fa8c0 100644 (file)
@@ -159,7 +159,7 @@ static struct kvm_vcpu_hv_synic *synic_get(struct kvm *kvm, u32 vpidx)
        struct kvm_vcpu_hv_synic *synic;
 
        vcpu = get_vcpu_by_vpidx(kvm, vpidx);
-       if (!vcpu)
+       if (!vcpu || !to_hv_vcpu(vcpu))
                return NULL;
        synic = to_hv_synic(vcpu);
        return (synic->active) ? synic : NULL;