From: Manuel Andreas Date: Wed, 23 Jul 2025 15:51:20 +0000 (+0200) Subject: KVM: x86/xen: Fix cleanup logic in emulation of Xen schedop poll hypercalls X-Git-Tag: v6.16~17^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a53249d149f48b558368c5338b9921b76a12f8c;p=thirdparty%2Fkernel%2Flinux.git KVM: x86/xen: Fix cleanup logic in emulation of Xen schedop poll hypercalls kvm_xen_schedop_poll does a kmalloc_array() when a VM polls the host for more than one event channel potr (nr_ports > 1). After the kmalloc_array(), the error paths need to go through the "out" label, but the call to kvm_read_guest_virt() does not. Fixes: 92c58965e965 ("KVM: x86/xen: Use kvm_read_guest_virt() instead of open-coding it badly") Reviewed-by: David Woodhouse Signed-off-by: Manuel Andreas [Adjusted commit message. - Paolo] Signed-off-by: Paolo Bonzini --- diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 5fa2cca436534..d6b2a665b499d 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -1526,7 +1526,7 @@ static bool kvm_xen_schedop_poll(struct kvm_vcpu *vcpu, bool longmode, if (kvm_read_guest_virt(vcpu, (gva_t)sched_poll.ports, ports, sched_poll.nr_ports * sizeof(*ports), &e)) { *r = -EFAULT; - return true; + goto out; } for (i = 0; i < sched_poll.nr_ports; i++) {