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


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] 6+ messages in thread
* [PATCH v2] xen: fix memory leak in __xen_pcibk_add_pci_dev()
@ 2014-04-01 10:15 Daeseok Youn
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01 10:15 [PATCH v2] xen: fix memory leak in __xen_pcibk_add_pci_dev() Daeseok Youn
2014-04-01 10:48 ` Jan Beulich
2014-04-01 10:48 ` Jan Beulich
2014-04-03 11:55 ` David Vrabel
2014-04-03 11:55   ` David Vrabel
  -- strict thread matches above, loose matches on Subject: below --
2014-04-01 10:15 Daeseok Youn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.