summaryrefslogtreecommitdiffstats
path: root/hw/ppc/spapr_pci.c
diff options
context:
space:
mode:
authorGreg Kurz2019-02-07 18:28:37 +0100
committerDavid Gibson2019-02-17 11:54:02 +0100
commit925969c3e28692b04ad4075022f985702bf62419 (patch)
treed476881de3eaa848a5e02c528504d45666162ed2 /hw/ppc/spapr_pci.c
parenttarget/ppc: Fix msync to do what hardware does (diff)
downloadqemu-925969c3e28692b04ad4075022f985702bf62419.tar.gz
qemu-925969c3e28692b04ad4075022f985702bf62419.tar.xz
qemu-925969c3e28692b04ad4075022f985702bf62419.zip
spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
Now that IRQ allocation has been split in two (first allocate IRQ numbers, then claim them), if the claiming fails, we must release the IRQs. Fixes: 4fe75a8ccd80 "spapr: split the IRQ allocation sequence" Signed-off-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_pci.c')
-rw-r--r--hw/ppc/spapr_pci.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 41d81f4a85..c3fb0ac884 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -393,6 +393,12 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRMachineState *spapr,
for (i = 0; i < req_num; i++) {
spapr_irq_claim(spapr, irq + i, false, &err);
if (err) {
+ if (i) {
+ spapr_irq_free(spapr, irq, i);
+ }
+ if (!smc->legacy_irq_allocation) {
+ spapr_irq_msi_free(spapr, irq, req_num);
+ }
error_reportf_err(err, "Can't allocate MSIs for device %x: ",
config_addr);
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);