linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/IOV: Fix memory leak in pci_iov_add_virtfn()
@ 2019-11-22 19:31 Navid Emamdoost
  2019-11-25 18:04 ` Nathan Chancellor
  0 siblings, 1 reply; 6+ messages in thread
From: Navid Emamdoost @ 2019-11-22 19:31 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel; +Cc: emamd001, Navid Emamdoost

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-28  7:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 19:31 [PATCH] PCI/IOV: Fix memory leak in pci_iov_add_virtfn() Navid Emamdoost
2019-11-25 18:04 ` Nathan Chancellor
2019-11-25 19:33   ` Navid Emamdoost
2019-11-25 19:52   ` [PATCH v2] " Navid Emamdoost
2019-11-26 23:35     ` Bjorn Helgaas
2019-11-28  7:08     ` Markus Elfring

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