lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 26 May 2013 23:53:01 +0800
From:	Jiang Liu <liuj97@...il.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>,
	Yinghai Lu <yinghai@...nel.org>
Cc:	Jiang Liu <jiang.liu@...wei.com>,
	"Rafael J . Wysocki" <rjw@...k.pl>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Gu Zheng <guz.fnst@...fujitsu.com>,
	Toshi Kani <toshi.kani@...com>,
	Myron Stowe <myron.stowe@...hat.com>,
	Yijing Wang <wangyijing@...wei.com>,
	Jiang Liu <liuj97@...il.com>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v3, part2 04/20] PCI, IOV: hold a reference to PCI bus when creating virtual PCI devices

Also use new iterator to walk PCI devices of a PCI bus.

Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
---
 drivers/pci/iov.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 5eb8165..4b796d6 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -36,19 +36,17 @@ static struct pci_bus *virtfn_add_bus(struct pci_bus *bus, int busnr)
 	struct pci_bus *child;
 
 	if (bus->number == busnr)
-		return bus;
+		return pci_bus_get(bus);
 
-	child = pci_find_bus(pci_domain_nr(bus), busnr);
+	child = pci_get_bus(pci_domain_nr(bus), busnr);
 	if (child)
 		return child;
 
 	child = pci_add_new_bus(bus, NULL, busnr);
-	if (!child)
-		return NULL;
-
-	pci_bus_insert_busn_res(child, busnr, busnr);
+	if (child)
+		pci_bus_insert_busn_res(child, busnr, busnr);
 
-	return child;
+	return pci_bus_get(child);
 }
 
 static void virtfn_remove_bus(struct pci_bus *physbus, struct pci_bus *virtbus)
@@ -113,6 +111,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
 		goto failed2;
 
 	kobject_uevent(&virtfn->dev.kobj, KOBJ_CHANGE);
+	pci_bus_put(bus);
 
 	return 0;
 
@@ -125,6 +124,7 @@ failed1:
 	virtfn_remove_bus(dev->bus, bus);
 failed0:
 	mutex_unlock(&iov->dev->sriov->lock);
+	pci_bus_put(bus);
 
 	return rc;
 }
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ