Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi/acpica/Subsystem Fix a reference count problem ...
details: https://anonhg.NetBSD.org/src/rev/90a9b45b7b0b
branches: trunk
changeset: 547122:90a9b45b7b0b
user: kochi <kochi%NetBSD.org@localhost>
date: Tue May 13 13:29:00 2003 +0000
description:
Fix a reference count problem that may cause unexpected memory free etc.
This is a backport of the latest ACPI CA that has a fix for this.
diffstat:
sys/dev/acpi/acpica/Subsystem/nsalloc.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diffs (46 lines):
diff -r a047ddd48d33 -r 90a9b45b7b0b sys/dev/acpi/acpica/Subsystem/nsalloc.c
--- a/sys/dev/acpi/acpica/Subsystem/nsalloc.c Tue May 13 13:07:13 2003 +0000
+++ b/sys/dev/acpi/acpica/Subsystem/nsalloc.c Tue May 13 13:29:00 2003 +0000
@@ -115,7 +115,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nsalloc.c,v 1.7 2003/05/13 13:07:13 kochi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nsalloc.c,v 1.8 2003/05/13 13:29:00 kochi Exp $");
#define __NSALLOC_C__
@@ -457,6 +457,7 @@
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *NextNode;
+ ACPI_NAMESPACE_NODE *Node;
UINT8 Flags;
@@ -505,6 +506,25 @@
* Detach an object if there is one, then free the child node
*/
AcpiNsDetachObject (ChildNode);
+
+ /*
+ * Decrement the reference count(s) of all parents up to
+ * the root! (counts were incremented when the node was created)
+ */
+ Node = ChildNode;
+ while ((Node = AcpiNsGetParentNode (Node)) != NULL) {
+ Node->ReferenceCount--;
+ }
+
+ /* There should be only one reference remaining on this node */
+
+ if (ChildNode->ReferenceCount != 1) {
+ ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n",
+ ChildNode->ReferenceCount, ChildNode));
+ }
+
+ /* Now we can delete the node */
+
ACPI_MEM_FREE (ChildNode);
/* And move on to the next child in the list */
Home |
Main Index |
Thread Index |
Old Index