[PATCH] PCI Hotplug: fix CPCI reference counting bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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;
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux