xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xen: fix memory leak in __xen_pcibk_add_pci_dev()
@ 2014-04-01 10:15 Daeseok Youn
  0 siblings, 0 replies; 3+ messages in thread
From: Daeseok Youn @ 2014-04-01 10:15 UTC (permalink / raw)
  To: konrad.wilk
  Cc: linux-kernel, david.vrabel, JBeulich, joe, xen-devel,
	boris.ostrovsky


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>
---
v2: The kfree() invocation is moved outside the locked region.

 drivers/xen/xen-pciback/vpci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c
index 3165ce3..51afff9 100644
--- a/drivers/xen/xen-pciback/vpci.c
+++ b/drivers/xen/xen-pciback/vpci.c
@@ -137,6 +137,8 @@ unlock:
 	/* Publish this device. */
 	if (!err)
 		err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid);
+	else
+		kfree(dev_entry);
 
 out:
 	return err;
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xen: fix memory leak in __xen_pcibk_add_pci_dev()
       [not found] <2172979.BN2CJo57Rq@daeseok-laptop.cloud.net>
@ 2014-04-01 10:48 ` Jan Beulich
  2014-04-03 11:55 ` David Vrabel
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2014-04-01 10:48 UTC (permalink / raw)
  To: Daeseok Youn, konrad.wilk
  Cc: joe, xen-devel, boris.ostrovsky, david.vrabel, linux-kernel

>>> On 01.04.14 at 12:15, <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>

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

> ---
> v2: The kfree() invocation is moved outside the locked region.
> 
>  drivers/xen/xen-pciback/vpci.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c
> index 3165ce3..51afff9 100644
> --- a/drivers/xen/xen-pciback/vpci.c
> +++ b/drivers/xen/xen-pciback/vpci.c
> @@ -137,6 +137,8 @@ unlock:
>  	/* Publish this device. */
>  	if (!err)
>  		err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid);
> +	else
> +		kfree(dev_entry);
>  
>  out:
>  	return err;
> -- 
> 1.7.4.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xen: fix memory leak in __xen_pcibk_add_pci_dev()
       [not found] <2172979.BN2CJo57Rq@daeseok-laptop.cloud.net>
  2014-04-01 10:48 ` [PATCH v2] xen: fix memory leak in __xen_pcibk_add_pci_dev() Jan Beulich
@ 2014-04-03 11:55 ` David Vrabel
  1 sibling, 0 replies; 3+ messages in thread
From: David Vrabel @ 2014-04-03 11:55 UTC (permalink / raw)
  To: Daeseok Youn; +Cc: linux-kernel, JBeulich, joe, xen-devel, boris.ostrovsky

On 01/04/14 11:15, Daeseok Youn 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'

Applied to devel/for-linus-3.15.

Thanks.

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-03 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2172979.BN2CJo57Rq@daeseok-laptop.cloud.net>
2014-04-01 10:48 ` [PATCH v2] xen: fix memory leak in __xen_pcibk_add_pci_dev() Jan Beulich
2014-04-03 11:55 ` David Vrabel
2014-04-01 10:15 Daeseok Youn

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).