Before taking gpc->lock, ensure it has been initialized. Signed-off-by: Michal Luczaj <mhal@xxxxxxx> --- arch/x86/kvm/xen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index e32c2cf06223..c5d431a54afa 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -965,6 +965,9 @@ static bool wait_pending_event(struct kvm_vcpu *vcpu, int nr_ports, bool ret = true; int idx, i; + if (!gpc->active) + return true; + read_lock_irqsave(&gpc->lock, flags); idx = srcu_read_lock(&kvm->srcu); if (!kvm_gfn_to_pfn_cache_check(kvm, gpc, gpc->gpa, PAGE_SIZE)) -- 2.37.2