[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 <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
commit 03e49d40ea3436cae0fe43708f11584130ee4a0c
tree acaa11b11c0ff1d4c9f743c0d8df2bc5a865a440
parent 5273a00d9c763108397658d440618f7ac3e40f83
author Scott Murray <[EMAIL PROTECTED]> Mon, 06 Jun 2005 15:48:04 -0400
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Thu, 09 Jun 2005 01:37:59 -0700

 drivers/pci/hotplug/cpci_hotplug_core.c |    2 ++
 drivers/pci/hotplug/cpci_hotplug_pci.c  |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c 
b/drivers/pci/hotplug/cpci_hotplug_core.c
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -217,6 +217,8 @@ static void release_slot(struct hotplug_
        kfree(slot->hotplug_slot->info);
        kfree(slot->hotplug_slot->name);
        kfree(slot->hotplug_slot);
+       if (slot->dev)
+               pci_dev_put(slot->dev);
        kfree(slot);
 }
 
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c 
b/drivers/pci/hotplug/cpci_hotplug_pci.c
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -315,9 +315,12 @@ int cpci_unconfigure_slot(struct slot* s
                                    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;
 }
[EMAIL PROTECTED]
[PATCH] PCI Hotplug: fix CPCI reference counting bug
[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 <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
commit 03e49d40ea3436cae0fe43708f11584130ee4a0c
tree acaa11b11c0ff1d4c9f743c0d8df2bc5a865a440
parent 5273a00d9c763108397658d440618f7ac3e40f83
author Scott Murray <[EMAIL PROTECTED]> Mon, 06 Jun 2005 15:48:04 -0400
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Thu, 09 Jun 2005 01:37:59 -0700

 drivers/pci/hotplug/cpci_hotplug_core.c |    2 ++
 drivers/pci/hotplug/cpci_hotplug_pci.c  |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c 
b/drivers/pci/hotplug/cpci_hotplug_core.c
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -217,6 +217,8 @@ static void release_slot(struct hotplug_
        kfree(slot->hotplug_slot->info);
        kfree(slot->hotplug_slot->name);
        kfree(slot->hotplug_slot);
+       if (slot->dev)
+               pci_dev_put(slot->dev);
        kfree(slot);
 }
 
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c 
b/drivers/pci/hotplug/cpci_hotplug_pci.c
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -315,9 +315,12 @@ int cpci_unconfigure_slot(struct slot* s
                                    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;
 }



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r 
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to