Skip to content

Commit

Permalink
Utilities: Avoid deleting the same object twice in a row
Browse files Browse the repository at this point in the history
If OriginalCount is 0 in AcpiUtUpdateRefCount (),
AcpiUtDeleteInternalObj () is invoked for the target object, which is
incorrect, because that object has been deleted once already and the
memory allocated to store it may have been reclaimed and allocated
for a different purpose by the host OS.  Moreover, a confusing debug
message following the "Reference Count is already zero, cannot
decrement" warning is printed in that case.

To fix this issue, make AcpiUtUpdateRefCount () return after finding
that OriginalCount is 0 and printing the above warning.

Link: #652
Reported-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
rafaeljw committed Nov 10, 2021
1 parent 0420852 commit c11af67
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions source/components/utilities/utdelete.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ AcpiUtUpdateRefCount (
ACPI_WARNING ((AE_INFO,
"Obj %p, Reference Count is already zero, cannot decrement\n",
Object));
return;
}

ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
Expand Down

0 comments on commit c11af67

Please sign in to comment.