]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
vpci/msi: fix unbind loop
authorRoger Pau Monné <roger.pau@citrix.com>
Wed, 16 May 2018 14:28:46 +0000 (16:28 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 16 May 2018 14:28:46 +0000 (16:28 +0200)
The current unbind loop on failure in vpci_msi_enable is wrong and
will only work correctly if the initial pirq is 0. Fix this by adding
a proper bound.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hvm/vmsi.c

index 900d4f67d4ec45fdc727377e157e4bb1cdde8bd1..5ab7387d78fabe887427112b79c6c95f9e9cdb34 100644 (file)
@@ -710,7 +710,7 @@ static int vpci_msi_enable(const struct pci_dev *pdev, uint32_t data,
                      "%04x:%02x:%02x.%u: failed to bind PIRQ %u: %d\n",
                      pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn),
                      PCI_FUNC(pdev->devfn), pirq + i, rc);
-            while ( bind.machine_irq-- )
+            while ( bind.machine_irq-- > pirq )
                 pt_irq_destroy_bind(pdev->domain, &bind);
             spin_lock(&pdev->domain->event_lock);
             unmap_domain_pirq(pdev->domain, pirq);