[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] pciback: fix memory leak in __xen_pcibk_add_pci_dev()


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Tue, 01 Apr 2014 09:00:03 +0000
  • Delivery-date: Tue, 01 Apr 2014 09:00:56 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Daeseok Youn <daeseok.youn@xxxxxxxxx>
# Date 1396342464 -7200
# Node ID 52cb9a45cf3deb321d5b24d5c4c302a67ede16b1
# Parent  9d5980df7a806e7b3c2c3d864ab24d03c400890c
pciback: fix memory leak in __xen_pcibk_add_pci_dev()

It needs 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@xxxxxxxxx>

Moved kfree() invocation out of locked region.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 9d5980df7a80 -r 52cb9a45cf3d drivers/xen/pciback/vpci.c
--- a/drivers/xen/pciback/vpci.c        Tue Mar 11 14:30:55 2014 +0100
+++ b/drivers/xen/pciback/vpci.c        Tue Apr 01 10:54:24 2014 +0200
@@ -134,9 +134,11 @@ int pciback_add_pci_dev(struct pciback_d
       unlock:
        spin_unlock_irqrestore(&vpci_dev->lock, flags);
 
-       /* Publish this device. */
-       if(!err)
+       if (!err) {
+               /* Publish this device. */
                err = publish_cb(pdev, 0, 0, PCI_DEVFN(slot, func), devid);
+       } else
+               kfree(dev_entry);
 
       out:
        return err;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.