[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr_pci: Fix interrupt leak in rta
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path |
Date: |
Fri, 8 Feb 2019 13:54:18 +0100 |
On Fri, 8 Feb 2019 22:33:36 +1100
David Gibson <address@hidden> wrote:
> On Fri, Feb 08, 2019 at 12:15:03PM +0100, Greg Kurz wrote:
> > On Fri, 8 Feb 2019 10:06:47 +1100
> > David Gibson <address@hidden> wrote:
> >
> > > On Thu, Feb 07, 2019 at 06:28:37PM +0100, Greg Kurz wrote:
> > > > 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 <address@hidden>
> > >
> > > Applied to ppc-for-4.0, thanks.
> > >
> >
> > Oops I've just realized there's an off-by-one error...
> >
> > > > ---
> > > > hw/ppc/spapr_pci.c | 6 ++++++
> > > > 1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> > > > index 41d81f4a8500..6fe3c10c8d4c 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 + 1);
> >
> > ... here. It should actually be:
> >
> > + spapr_irq_free(spapr, irq, i);
> >
> > Can you fix this in your tree or should I post a v2 ?
>
> Fixed up inline.
>
Thanks !
> >
> > > > + }
> > > > + 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);
> > > >
> > >
> >
>
>
>
pgpgMzG3IZwE4.pgp
Description: OpenPGP digital signature