mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: "Daeseok Youn" <daeseok.youn@gmail.com>, <konrad.wilk@oracle.com>
Cc: <david.vrabel@citrix.com>, <xen-devel@lists.xenproject.org>,
	<boris.ostrovsky@oracle.com>, <joe@perches.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH] xen: fix memory leak in __xen_pcibk_add_pci_dev()
Date: Tue, 01 Apr 2014 08:23:51 +0100	[thread overview]
Message-ID: <533A85A70200007800003F59@nat28.tlf.novell.com> (raw)
In-Reply-To: <2186395.ZOncrV6nFS@daeseok-laptop.cloud.net>

>>> On 31.03.14 at 12:08, <daeseok.youn@gmail.com> wrote:

> It need to free dev_entry when it failed to assign to a new
> slot on the virtual PCI bus.
> 
> smatch says:
>  drivers/xen/xen-pciback/vpci.c:142 __xen_pcibk_add_pci_dev() warn:
> possible memory leak of 'dev_entry'
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

albeit the solution is not ideal:

> --- a/drivers/xen/xen-pciback/vpci.c
> +++ b/drivers/xen/xen-pciback/vpci.c
> @@ -130,6 +130,7 @@ static int __xen_pcibk_add_pci_dev(struct 
> xen_pcibk_device *pdev,
>  	err = -ENOMEM;
>  	xenbus_dev_fatal(pdev->xdev, err,
>  			 "No more space on root virtual PCI bus");
> +	kfree(dev_entry);
>  
>  unlock:
>  	mutex_unlock(&vpci_dev->lock);

The kfree() invocation would better be placed outside the locked
region (e.g. in an else to the "if (!err)" a little further down).

Jan


  reply	other threads:[~2014-04-01  7:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31 10:08 Daeseok Youn
2014-04-01  7:23 ` Jan Beulich [this message]
2014-04-01  8:17   ` [Xen-devel] " DaeSeok Youn

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=533A85A70200007800003F59@nat28.tlf.novell.com \
    --to=jbeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=daeseok.youn@gmail.com \
    --cc=david.vrabel@citrix.com \
    --cc=joe@perches.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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

all inboxes | Powered by JetHome®