Skip to content

Commit

Permalink
[PATCH] PCI Hotplug: fix CPCI reference counting bug
Browse files Browse the repository at this point in the history
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: Scott Murray <scottm@somanetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Scott Murray authored and Greg Kroah-Hartman committed Jun 9, 2005
1 parent 5273a00 commit 03e49d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions drivers/pci/hotplug/cpci_hotplug_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
kfree(slot->hotplug_slot->info);
kfree(slot->hotplug_slot->name);
kfree(slot->hotplug_slot);
if (slot->dev)
pci_dev_put(slot->dev);
kfree(slot);
}

Expand Down
5 changes: 4 additions & 1 deletion drivers/pci/hotplug/cpci_hotplug_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,12 @@ int cpci_unconfigure_slot(struct slot* slot)
PCI_DEVFN(PCI_SLOT(slot->devfn), i));
if (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__);
return 0;
}

0 comments on commit 03e49d4

Please sign in to comment.