Before taking gpc->lock, ensure it has been initialized. Signed-off-by: Michal Luczaj <mhal@xxxxxxx> --- arch/x86/kvm/xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 280cb5dc7341..e32c2cf06223 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -1348,7 +1348,7 @@ int kvm_xen_set_evtchn_fast(struct kvm_xen_evtchn *xe, struct kvm *kvm) WRITE_ONCE(xe->vcpu_idx, vcpu->vcpu_idx); } - if (!vcpu->arch.xen.vcpu_info_cache.active) + if (!vcpu->arch.xen.vcpu_info_cache.active || !gpc->active) return -EINVAL; if (xe->port >= max_evtchn_port(kvm)) -- 2.37.2