[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PULL 08/21] hw/i386/kvm/xen_evtchn: Fix off-by-one in do_remove_pci_vector()



From: David Woodhouse <dwmw@xxxxxxxxxxxx>

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 <benquike@xxxxxxxxx>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4525
Reviewed-by: Paul Durrant <paul@xxxxxxx>
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
 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 3aff01b5d6..d0807f5fec 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.55.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.