Fix false AE_NOT_FOUND messages, reported in NetBSD port-i386/20897.

NetBSD dsmethod.c rev 1.7

Fix parent-child loop problem
Fix a reference count problem that may cause unexpected memory free
Intel 20030512 ACPICA drop (nsalloc.c)

Approved by:	re (jhb)
Obtained from:	NetBSD, Intel
Reported by:	mbr, kochi AT netbsd.org
This commit is contained in:
Nate Lawson 2003-05-27 19:19:05 +00:00
parent 0f78c17f6f
commit 006b3ddb51
2 changed files with 44 additions and 4 deletions

View File

@ -378,6 +378,8 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
/* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
* $Revision: 79 $
* $Revision: 82 $
*
******************************************************************************/
@ -192,6 +192,8 @@ AcpiNsDeleteNode (
PrevNode = NULL;
NextNode = ParentNode->Child;
/* Find the node that is the previous peer in the parent's child list */
while (NextNode != Node)
{
PrevNode = NextNode;
@ -200,6 +202,8 @@ AcpiNsDeleteNode (
if (PrevNode)
{
/* Node is not first child, unlink it */
PrevNode->Peer = NextNode->Peer;
if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
@ -208,7 +212,19 @@ AcpiNsDeleteNode (
}
else
{
ParentNode->Child = NextNode->Peer;
/* Node is first child (has no previous peer) */
if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
/* No peers at all */
ParentNode->Child = NULL;
}
else
{ /* Link peer list to parent */
ParentNode->Child = NextNode->Peer;
}
}
@ -305,7 +321,7 @@ AcpiNsInstallNode (
ACPI_NAMESPACE_NODE *Node, /* New Child*/
ACPI_OBJECT_TYPE Type)
{
UINT16 OwnerId = TABLE_ID_DSDT;
UINT16 OwnerId = 0;
ACPI_NAMESPACE_NODE *ChildNode;
#ifdef ACPI_ALPHABETIC_NAMESPACE
@ -448,6 +464,7 @@ AcpiNsDeleteChildren (
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *NextNode;
ACPI_NAMESPACE_NODE *Node;
UINT8 Flags;
@ -496,6 +513,27 @@ AcpiNsDeleteChildren (
* 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 */
@ -614,7 +652,7 @@ AcpiNsDeleteNamespaceSubtree (
*
******************************************************************************/
static void
void
AcpiNsRemoveReference (
ACPI_NAMESPACE_NODE *Node)
{