Skip to content

Commit 910f8be

Browse files
roygerjgross1
authored andcommitted
xen/pirq: fix error path cleanup when binding MSIs
Current cleanup in the error path of xen_bind_pirq_msi_to_irq is wrong. First of all there's an off-by-one in the cleanup loop, which can lead to unbinding wrong IRQs. Secondly IRQs not bound won't be freed, thus leaking IRQ numbers. Note that there's no need to differentiate between bound and unbound IRQs when freeing them, __unbind_from_irq will deal with both of them correctly. Fixes: 4892c9b ("xen: add support for MSI message groups") Reported-by: Hooman Mirhadi <[email protected]> Signed-off-by: Roger Pau Monné <[email protected]> Reviewed-by: Amit Shah <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 68d2059 commit 910f8be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/xen/events/events_base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,8 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
755755
mutex_unlock(&irq_mapping_update_lock);
756756
return irq;
757757
error_irq:
758-
for (; i >= 0; i--)
759-
__unbind_from_irq(irq + i);
758+
while (nvec--)
759+
__unbind_from_irq(irq + nvec);
760760
mutex_unlock(&irq_mapping_update_lock);
761761
return ret;
762762
}

0 commit comments

Comments
 (0)