[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191122193138.19278-1-navid.emamdoost@gmail.com>
Date: Fri, 22 Nov 2019 13:31:36 -0600
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: emamd001@....edu, Navid Emamdoost <navid.emamdoost@...il.com>
Subject: [PATCH] PCI/IOV: Fix memory leak in pci_iov_add_virtfn()
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@...il.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
Powered by blists - more mailing lists