[PATCH] PCI/IOV: Fix memory leak in pci_iov_add_virtfn()

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

 



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




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux