Commit 03e49d40 authored by Scott Murray's avatar Scott Murray Committed by Greg Kroah-Hartman

[PATCH] PCI Hotplug: fix CPCI reference counting bug

Here's a patch that fixes up the pci_dev refcounting in the CPCI code.
I've done some testing against it and it seems fine here.
Signed-off-by: default avatarScott Murray <scottm@somanetworks.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5273a00d
...@@ -217,6 +217,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot) ...@@ -217,6 +217,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
kfree(slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
kfree(slot->hotplug_slot->name); kfree(slot->hotplug_slot->name);
kfree(slot->hotplug_slot); kfree(slot->hotplug_slot);
if (slot->dev)
pci_dev_put(slot->dev);
kfree(slot); kfree(slot);
} }
......
...@@ -315,9 +315,12 @@ int cpci_unconfigure_slot(struct slot* slot) ...@@ -315,9 +315,12 @@ int cpci_unconfigure_slot(struct slot* slot)
PCI_DEVFN(PCI_SLOT(slot->devfn), i)); PCI_DEVFN(PCI_SLOT(slot->devfn), i));
if (dev) { if (dev) {
pci_remove_bus_device(dev); pci_remove_bus_device(dev);
slot->dev = NULL; pci_dev_put(dev);
} }
} }
pci_dev_put(slot->dev);
slot->dev = NULL;
dbg("%s - exit", __FUNCTION__); dbg("%s - exit", __FUNCTION__);
return 0; return 0;
} }
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