diff mbox series

[RFC,2/4] KVM: x86/xen: Ensure kvm_xen_schedop_poll() can use shinfo_cache

Message ID 20220916005405.2362180-3-mhal@rbox.co (mailing list archive)
State New, archived
Headers show
Series KVM: x86/xen: shinfo cache lock corruption | expand

Commit Message

Michal Luczaj Sept. 16, 2022, 12:54 a.m. UTC
Before taking gpc->lock, ensure it has been initialized.

Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
 arch/x86/kvm/xen.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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))