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]
Message-Id: <1347678312-11124-4-git-send-email-jiang.liu@huawei.com>
Date:	Sat, 15 Sep 2012 11:05:06 +0800
From:	Jiang Liu <liuj97@...il.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>
Cc:	Tony Luck <tony.luck@...el.com>,
	Yijing Wang <wangyijing@...wei.com>,
	Yinghai Lu <yinghai@...nel.org>,
	Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>,
	Jiang Liu <liuj97@...il.com>, linux-kernel@...r.kernel.org,
	linux-pci@...r.kernel.org, Jiang Liu <jiang.liu@...wei.com>
Subject: [PATCH v2 3/9] PCI: preserve dev->subordinate until pci_stop_dev() has been called

From: Yijing Wang <wangyijing@...wei.com>

Changeset 2ed168eeb3edec029aa0eca5cb981d6376f931f9 "PCI: Fold stop and
remove helpers into their callers" has changed the behavior when
removing a PCI device.

Previously, for a PCI bridge device with secondary bus, dev->subordinate
is valid when calling PCI bus notification callbacks for
BUS_NOTIFY_ADD_DEVICE/BUS_NOTIFY_DEL_DEVICE events. Now dev->subordinate
has been reset to NULL when calling callbacks for BUS_NOTIFY_DEL_DEVICE
events, which may break some PCI bus notification callbacks.

So revert to the original behavior to keep dev->subordinate valid for
both BUS_NOTIFY_ADD_DEVICE events and BUS_NOTIFY_DEL_DEVICE events.

Signed-off-by: Yijing Wang <wangyijing@...wei.com>
Signed-off-by: Jiang Liu <jiang.liu@...wei.com>
---
 drivers/pci/remove.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 86a4636..6244956 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -79,16 +79,16 @@ void pci_stop_and_remove_bus_device(struct pci_dev *dev)
 	 * iterator.  Therefore, iterate in reverse so we remove the VFs
 	 * first, then the PF.
 	 */
-	if (bus) {
+	if (bus)
 		list_for_each_entry_safe_reverse(child, tmp,
 						 &bus->devices, bus_list)
 			pci_stop_and_remove_bus_device(child);
+	pci_stop_dev(dev);
 
+	if (bus) {
 		pci_remove_bus(bus);
 		dev->subordinate = NULL;
 	}
-
-	pci_stop_dev(dev);
 	pci_destroy_dev(dev);
 }
 EXPORT_SYMBOL(pci_stop_and_remove_bus_device);
-- 
1.7.9.5

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