[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101108153404.GA8637@dumpdata.com>
Date: Mon, 8 Nov 2010 10:34:04 -0500
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: Jiri Slaby <jslaby@...e.cz>
Cc: jirislaby@...il.com, linux-kernel@...r.kernel.org,
xen-devel@...ts.xensource.com,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org
Subject: Re: [PATCH] x86: pci/xen, fix memory leak
On Sat, Nov 06, 2010 at 10:06:49AM +0100, Jiri Slaby wrote:
> Stanse found that xen_setup_msi_irqs leaks memory when
> xen_allocate_pirq fails. Free the memory in that fail path.
Duh! Yes, sticking it in the queue for bug-fixes. Thank you
for finding it.
>
> Signed-off-by: Jiri Slaby <jslaby@...e.cz>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Cc: xen-devel@...ts.xensource.com
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: x86@...nel.org
> ---
> arch/x86/pci/xen.c | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
> index 117f5b8..d7b5109 100644
> --- a/arch/x86/pci/xen.c
> +++ b/arch/x86/pci/xen.c
> @@ -147,8 +147,10 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> irq = xen_allocate_pirq(v[i], 0, /* not sharable */
> (type == PCI_CAP_ID_MSIX) ?
> "pcifront-msi-x" : "pcifront-msi");
> - if (irq < 0)
> - return -1;
> + if (irq < 0) {
> + ret = -1;
> + goto free;
> + }
>
> ret = set_irq_msi(irq, msidesc);
> if (ret)
> @@ -164,7 +166,7 @@ error:
> if (ret == -ENODEV)
> dev_err(&dev->dev, "Xen PCI frontend has not registered" \
> " MSI/MSI-X support!\n");
> -
> +free:
> kfree(v);
> return ret;
> }
> --
> 1.7.3.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists