Skip to content

Commit

Permalink
spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
Browse files Browse the repository at this point in the history
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: 4fe75a8 "spapr: split the IRQ allocation sequence"
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
gkurz authored and dgibson committed Feb 17, 2019
1 parent 27a3ea7 commit 925969c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hw/ppc/spapr_pci.c
Expand Up @@ -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);
Expand Down

0 comments on commit 925969c

Please sign in to comment.