summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2018-02-28 09:19:03 +0000
committerBen Hutchings <ben@decadent.org.uk>2018-06-16 22:22:30 +0100
commit308c157d85743d4ee3a9f01b7282816af699e3ba (patch)
tree8082ecb25936832818c7f7ae6a2cad663fa6fb83
parent69992a0ace74c52c41e63ff98e49dde44bd2d178 (diff)
downloadlinux-stable-308c157d85743d4ee3a9f01b7282816af699e3ba.tar.gz
linux-stable-308c157d85743d4ee3a9f01b7282816af699e3ba.tar.bz2
linux-stable-308c157d85743d4ee3a9f01b7282816af699e3ba.zip
xen/pirq: fix error path cleanup when binding MSIs
commit 910f8befdf5bccf25287d9f1743e3e546bcb7ce0 upstream. 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: 4892c9b4ada9f9 ("xen: add support for MSI message groups") Reported-by: Hooman Mirhadi <mirhadih@amazon.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Amit Shah <aams@amazon.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/xen/events/events_base.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index b254b7d20dfa..7e93925ace03 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -763,8 +763,8 @@ out:
mutex_unlock(&irq_mapping_update_lock);
return irq;
error_irq:
- for (; i >= 0; i--)
- __unbind_from_irq(irq + i);
+ while (nvec--)
+ __unbind_from_irq(irq + nvec);
mutex_unlock(&irq_mapping_update_lock);
return ret;
}