Commit b86da52f authored by John Rose's avatar John Rose Committed by Greg Kroah-Hartman

[PATCH] PCI Hotplug: rpaphp safe list traversal

Hoping you will accept this fix.  The bug can cause a crash upon hotplug
remove.  The bug involves unsafe traversal of a list while deleting list
members.  The fix uses list_for_each_safe() rather than
list_for_each().  Also threw in an initialization to get rid of a
compiler warning.
Signed-off-by: default avatarJohn Rose <johnrose@austin.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 532d0c6a
......@@ -362,7 +362,7 @@ static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev)
int rpaphp_unconfig_pci_adapter(struct slot *slot)
{
int retval = 0;
struct list_head *ln;
struct list_head *ln, *tmp;
dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name);
if (list_empty(&slot->dev.pci_funcs)) {
......@@ -373,7 +373,7 @@ int rpaphp_unconfig_pci_adapter(struct slot *slot)
goto exit;
}
/* remove the devices from the pci core */
list_for_each (ln, &slot->dev.pci_funcs) {
list_for_each_safe (ln, tmp, &slot->dev.pci_funcs) {
struct rpaphp_pci_func *func;
func = list_entry(ln, struct rpaphp_pci_func, sibling);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment