ACPICA: Update for automatic repair code for objects returned by evaluate_object
authorBob Moore <robert.moore@intel.com>
Wed, 26 Apr 2017 08:18:16 +0000 (16:18 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 26 Apr 2017 22:31:00 +0000 (00:31 +0200)
ACPICA commit 6b58810b9aad7358fbf1a0f4057fefa8d29838d3

This change fixes two instances where the repair code made an incorrect
assumption about how reference counts are assigned to package objects.
Resolves issues where a warning was issued about a "large reference
count" -- which usually indicates an attempt to delete an object
that has previously been poisoned and released into the object cache.

Link: https://github.com/acpica/acpica/commit/6b58810b
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/nsrepair.c
drivers/acpi/acpica/nsrepair2.c

index 38316266521ea3f67367c1b4549a5166ec4cd750..418ef2ac82abed3bf64f1d8442fdeabb82bd3d9a 100644 (file)
@@ -290,22 +290,12 @@ object_repaired:
        /* Object was successfully repaired */
 
        if (package_index != ACPI_NOT_PACKAGE_ELEMENT) {
-               /*
-                * The original object is a package element. We need to
-                * decrement the reference count of the original object,
-                * for removing it from the package.
-                *
-                * However, if the original object was just wrapped with a
-                * package object as part of the repair, we don't need to
-                * change the reference count.
-                */
+
+               /* Update reference count of new object */
+
                if (!(info->return_flags & ACPI_OBJECT_WRAPPED)) {
                        new_object->common.reference_count =
                            return_object->common.reference_count;
-
-                       if (return_object->common.reference_count > 1) {
-                               return_object->common.reference_count--;
-                       }
                }
 
                ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
index 352265498e90e9298ab7cf4fe0c6a715de478d0c..06037e0446941368c6702411e8054ae5a7644e6a 100644 (file)
@@ -403,16 +403,12 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info,
                        return (status);
                }
 
-               /* Take care with reference counts */
-
                if (original_element != *element_ptr) {
 
-                       /* Element was replaced */
+                       /* Update reference count of new object */
 
                        (*element_ptr)->common.reference_count =
                            original_ref_count;
-
-                       acpi_ut_remove_reference(original_element);
                }
 
                element_ptr++;