public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: jirislaby@gmail.com, linux-kernel@vger.kernel.org,
	xen-devel@lists.xensource.com,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Subject: Re: [PATCH] x86: pci/xen, fix memory leak
Date: Mon, 8 Nov 2010 10:34:04 -0500	[thread overview]
Message-ID: <20101108153404.GA8637@dumpdata.com> (raw)
In-Reply-To: <1289034412-24278-1-git-send-email-jslaby@suse.cz>

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@suse.cz>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: xen-devel@lists.xensource.com
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.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
> 

      parent reply	other threads:[~2010-11-08 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-06  9:06 [PATCH] x86: pci/xen, fix memory leak Jiri Slaby
2010-11-06  9:06 ` [PATCH] Char: virtio_console, " Jiri Slaby
2010-11-07 23:28   ` Rusty Russell
2010-11-06  9:06 ` [PATCH] IDE: ide-floppy, remove unnecessary NULL check Jiri Slaby
2010-11-06 12:00   ` Sergei Shtylyov
2010-11-06 12:10   ` Borislav Petkov
2010-11-22 19:39   ` David Miller
2010-11-06  9:06 ` [PATCH] ocfs2: fix memory leak Jiri Slaby
2010-11-18 23:42   ` Joel Becker
2010-11-08 15:34 ` Konrad Rzeszutek Wilk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101108153404.GA8637@dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=hpa@zytor.com \
    --cc=jirislaby@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox