[PATCH] PCI, IOV: fix a resource leakage on error recovery path

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

 



Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxx>
---
Hi Bjorn,
	Could you please help to apply this small patch onto the
jiang-bus-lock-v3, which addresses a memory leakage issue pointed
out by Yinghai? Or you may fold it into " PCI, IOV: simplify IOV 
implementation".
Thanks!
Gerry
---
 drivers/pci/iov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 5eb8165..458fb39 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -122,8 +122,9 @@ failed1:
 	pci_dev_put(dev);
 	mutex_lock(&iov->dev->sriov->lock);
 	pci_stop_and_remove_bus_device(virtfn);
-	virtfn_remove_bus(dev->bus, bus);
 failed0:
+	if (bus)
+		virtfn_remove_bus(dev->bus, bus);
 	mutex_unlock(&iov->dev->sriov->lock);
 
 	return rc;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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