xen: fix memory leak in __xen_pcibk_add_pci_dev()
PATCH v2 1/1 xen: fix memory leak in __xen_pcibk_add_pci_dev()
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'
---
v2: The kfree() invocation is moved outside the locked region.
drivers/xen/xen-pciback/vpci.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/xen/xen-pciback/vpci.c +2 -0
@@ -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;
Signature · 1 line
1.7.4.4
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.04.14 at 12:15, <[email protected]> wrote:
It need to free
dev_entrywhen 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 <[email protected]>
As before
Quoted 21 lines
---
v2: Thekfree()invocation is moved outside the locked region.drivers/xen/xen-pciback/vpci.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/xen/xen-pciback/vpci.c +2
-0@@ -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;Signature · 1 line
1.7.4.4
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.04.14 at 12:15, <[email protected]> wrote:
It need to free
dev_entrywhen 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 <[email protected]>
As before
Quoted 21 lines
---
v2: Thekfree()invocation is moved outside the locked region.drivers/xen/xen-pciback/vpci.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/xen/xen-pciback/vpci.c +2
-0@@ -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;Signature · 1 line
1.7.4.4
David Vrabel
AppliedQuoted 7 lines · Daeseok Youn
It need to free
dev_entrywhen 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