From: David Woodhouse The empty-word optimisation advanced pirq by 64 on top of the loop increment, so the first PIRQ of the following word was never examined and could retain a stale device binding after the device was removed. Fixes: 6096cf7877bc ("hw/xen: Support MSI mapping to PIRQ") Reported-by: Hui Peng Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4525 Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 3aff01b5d6c..d0807f5fece 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -1701,7 +1701,7 @@ static void do_remove_pci_vector(XenEvtchnState *s, PCIDevice *dev, int vector, * and cache lines). */ if (!(pirq & 63) && !(pirq_inuse_word(s, pirq))) { - pirq += 64; + pirq += 63; continue; } if (except_pirq && pirq == except_pirq) { -- 2.43.0