Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Scott Murray <scottm@somanetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Scott Murray and committed by
Greg Kroah-Hartman
03e49d40 5273a00d

+6 -1
+2
drivers/pci/hotplug/cpci_hotplug_core.c
··· 217 217 kfree(slot->hotplug_slot->info); 218 218 kfree(slot->hotplug_slot->name); 219 219 kfree(slot->hotplug_slot); 220 + if (slot->dev) 221 + pci_dev_put(slot->dev); 220 222 kfree(slot); 221 223 } 222 224
+4 -1
drivers/pci/hotplug/cpci_hotplug_pci.c
··· 315 315 PCI_DEVFN(PCI_SLOT(slot->devfn), i)); 316 316 if (dev) { 317 317 pci_remove_bus_device(dev); 318 - slot->dev = NULL; 318 + pci_dev_put(dev); 319 319 } 320 320 } 321 + pci_dev_put(slot->dev); 322 + slot->dev = NULL; 323 + 321 324 dbg("%s - exit", __FUNCTION__); 322 325 return 0; 323 326 }