Bug 492 - Crash in AcpiPsDeleteParseTree after an allocation failure in AcpiPsCompleteThisOp
: Crash in AcpiPsDeleteParseTree after an allocation failure in AcpiPsCompleteT...
Status: RESOLVED FIXED
: ACPICA
Core/Interpreter
: unspecified
: All Linux
: P2 normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2006-11-19 18:13 by
Modified: 2008-09-26 19:54 (History)


Attachments
proposed patch (2.17 KB, patch)
2008-09-05 02:07, Lin Ming
Details | Diff
updated patch (2.38 KB, patch)
2008-09-10 17:03, Bob Moore
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2006-11-19 18:13:27
This crash occurs in AcpiPsDeleteParseTree() called from
AcpiPsExecuteMethod() when on the testing conditions a call
to AcpiPsAllocOp() in AcpiPsCompleteThisOp() results in a failure.

The crash occurs due to presence in the initial Method Op parse
tree of some Op object previously deleted according with Allocate
error processing branch in AcpiPsCompleteThisOp (see below):

AcpiPsCompleteThisOp (
...
        default:

            ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
            if (!ReplacementOp)
            {
                goto AllocateError;
            }
...
AllocateError:

    /* Always delete the subtree, even on error */

    AcpiPsDeleteParseTree (Op);
    return_ACPI_STATUS (AE_NO_MEMORY);

On the normal conditions when AcpiPsAllocOp above succeeds the
ReplacementOp relocates the Op in the initial Method Op parse tree
and the next call to AcpiPsDeleteParseTree in AcpiPsExecuteMethod
is processed smoothly.

It looks like the comment "Always delete the subtree, even on error"
is not exactly substantiated. When on the considered testing conditions
the call to AcpiPsDeleteParseTree on the AllocateError branch is avoided
no any problem occurs.


INTERNAL API TS BUG NUMBER:

             44
------- Comment #1 From 2008-09-05 02:07:54 -------
Created an attachment (id=795) [details]
proposed patch

Currently, it does not unlink the Op from parent tree if allocation fails, this
causes segmentation fault at the next call to AcpiPsDeleteParseTree.

This patch continue to unlink the Op from parent tree if allocation fails.
------- Comment #2 From 2008-09-10 17:03:54 -------
Created an attachment (id=799) [details]
updated patch

Added else case when allocation of ReplacementOp fails
------- Comment #3 From 2008-09-26 19:54:26 -------
ship in ACPICA release 20080926