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

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