lkml.org 
[lkml]   [2019]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] PCI/IOV: Fix memory leak in pci_iov_add_virtfn()
Date
In the implementation of pci_iov_add_virtfn() the allocated virtfn is
leaked if pci_setup_device() fails. The error handling is not calling
pci_stop_and_remove_bus_device(). Change the goto label to failed2.

Fixes: 156c55325d30 ("PCI: Check for pci_setup_device() failure in pci_iov_add_virtfn()")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/pci/iov.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index b3f972e8cfed..713660482feb 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -164,7 +164,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id)

rc = pci_setup_device(virtfn);
if (rc)
- goto failed1;
+ goto failed2;

virtfn->dev.parent = dev->dev.parent;
virtfn->multifunction = 0;
--
2.17.1
\
 
 \ /
  Last update: 2019-11-22 20:32    [W:0.098 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site