* [Qemu-devel] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
@ 2019-02-07 17:28 Greg Kurz
2019-02-07 23:06 ` David Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kurz @ 2019-02-07 17:28 UTC (permalink / raw)
To: David Gibson
Cc: qemu-devel, qemu-ppc, Cédric Le Goater, Greg Kurz,
qemu-stable
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>
---
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);
+ }
+ 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);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
2019-02-07 17:28 [Qemu-devel] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path Greg Kurz
@ 2019-02-07 23:06 ` David Gibson
2019-02-08 11:15 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
0 siblings, 1 reply; 5+ messages in thread
From: David Gibson @ 2019-02-07 23:06 UTC (permalink / raw)
To: Greg Kurz; +Cc: qemu-devel, qemu-ppc, Cédric Le Goater, qemu-stable
[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]
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 <groug@kaod.org>
Applied to ppc-for-4.0, thanks.
> ---
> 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);
> + }
> + 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);
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
2019-02-07 23:06 ` David Gibson
@ 2019-02-08 11:15 ` Greg Kurz
2019-02-08 11:33 ` David Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kurz @ 2019-02-08 11:15 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-stable, qemu-ppc, qemu-devel, Cédric Le Goater
[-- Attachment #1: Type: text/plain, Size: 1596 bytes --]
On Fri, 8 Feb 2019 10:06:47 +1100
David Gibson <david@gibson.dropbear.id.au> 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 <groug@kaod.org>
>
> 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 ?
> > + }
> > + 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);
> >
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
2019-02-08 11:15 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
@ 2019-02-08 11:33 ` David Gibson
2019-02-08 12:54 ` Greg Kurz
0 siblings, 1 reply; 5+ messages in thread
From: David Gibson @ 2019-02-08 11:33 UTC (permalink / raw)
To: Greg Kurz; +Cc: qemu-stable, qemu-ppc, qemu-devel, Cédric Le Goater
[-- Attachment #1: Type: text/plain, Size: 1970 bytes --]
On Fri, Feb 08, 2019 at 12:15:03PM +0100, Greg Kurz wrote:
> On Fri, 8 Feb 2019 10:06:47 +1100
> David Gibson <david@gibson.dropbear.id.au> 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 <groug@kaod.org>
> >
> > 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.
>
> > > + }
> > > + 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);
> > >
> >
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
2019-02-08 11:33 ` David Gibson
@ 2019-02-08 12:54 ` Greg Kurz
0 siblings, 0 replies; 5+ messages in thread
From: Greg Kurz @ 2019-02-08 12:54 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-stable, qemu-ppc, qemu-devel, Cédric Le Goater
[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]
On Fri, 8 Feb 2019 22:33:36 +1100
David Gibson <david@gibson.dropbear.id.au> 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 <david@gibson.dropbear.id.au> 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 <groug@kaod.org>
> > >
> > > 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);
> > > >
> > >
> >
>
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-02-08 12:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-07 17:28 [Qemu-devel] [PATCH] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path Greg Kurz
2019-02-07 23:06 ` David Gibson
2019-02-08 11:15 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2019-02-08 11:33 ` David Gibson
2019-02-08 12:54 ` Greg Kurz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).