summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2004-07-01 23:33:23 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2004-07-01 23:33:23 -0700
commit1d52fdc0ac45e1a4db0ee04afb995f686bb0ac18 (patch)
treeb5f7584d35600e2ea3b605d8840d637c9d1706a8
parentab4038ad4febd95b14596baf011a85b9f3fb1151 (diff)
[PATCH] PCI Hotplug: rpaphp null pointer deref
This patch fixes a null-pointer dereference when hot-plug operations are performed on a machine that has virtual-io devices in it. Virtual i/o devices to not have pci bridges associated with them. It also corrects an ordering problem during hotplug remove. This patch was previously reviewed/tested by Linda Xie, the current rpaphp maintainer. Signed-off-by: Linas Vepstas <linas@linas.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 1fc2c3b820e8..a02425bc109e 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -378,8 +378,8 @@ int rpaphp_unconfig_pci_adapter(struct slot *slot)
func = list_entry(ln, struct rpaphp_pci_func, sibling);
if (func->pci_dev) {
- rpaphp_eeh_remove_bus_device(func->pci_dev);
pci_remove_bus_device(func->pci_dev);
+ rpaphp_eeh_remove_bus_device(func->pci_dev);
}
kfree(func);
}
@@ -513,9 +513,18 @@ struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev)
struct list_head *ln;
slot = list_entry(tmp, struct slot, rpaphp_slot_list);
+ if (slot->bridge == NULL) {
+ if (slot->dev_type == PCI_DEV) {
+ printk(KERN_WARNING "PCI slot missing bridge %s %s \n",
+ slot->name, slot->location);
+ }
+ continue;
+ }
+
bus = slot->bridge->subordinate;
- if (!bus)
- return NULL; /* shouldn't be here */
+ if (!bus) {
+ continue; /* should never happen? */
+ }
for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
struct pci_dev *pdev = pci_dev_b(ln);
if (pdev == dev)