ACPICA: Dispatcher: Fix a mutex issue for method auto serialization
authorLv Zheng <lv.zheng@intel.com>
Wed, 7 Sep 2016 06:07:16 +0000 (14:07 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 10 Sep 2016 00:43:02 +0000 (02:43 +0200)
ACPICA commit fd305eda14f1a1e684edef4fac53f194bf00ed3f

This patch fixes an issue with acpi_ds_auto_serialized_method().
The parser will invoke acpi_ex_release_all_mutexes(), which in return
cause mutexes held in ACPI_ERROR_METHOD() failed. Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1324
Link: https://github.com/acpica/acpica/commit/fd305eda
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Greg White <gwhite@kupulau.com>
Tested-by: Dutch Guy <lucht_piloot@gmx.net>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/dsmethod.c
drivers/acpi/acpica/psparse.c

index 25b387a6d8be17dcde66a72f864b99edff63445c..32e9ddc0cf2bbbf4a73afc640956fcc92715bbcd 100644 (file)
@@ -99,11 +99,14 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
                          "Method auto-serialization parse [%4.4s] %p\n",
                          acpi_ut_get_node_name(node), node));
 
+       acpi_ex_enter_interpreter();
+
        /* Create/Init a root op for the method parse tree */
 
        op = acpi_ps_alloc_op(AML_METHOD_OP, obj_desc->method.aml_start);
        if (!op) {
-               return_ACPI_STATUS(AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto unlock;
        }
 
        acpi_ps_set_name(op, node->name.integer);
@@ -115,7 +118,8 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
            acpi_ds_create_walk_state(node->owner_id, NULL, NULL, NULL);
        if (!walk_state) {
                acpi_ps_free_op(op);
-               return_ACPI_STATUS(AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto unlock;
        }
 
        status = acpi_ds_init_aml_walk(walk_state, op, node,
@@ -134,6 +138,8 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
        status = acpi_ps_parse_aml(walk_state);
 
        acpi_ps_delete_parse_tree(op);
+unlock:
+       acpi_ex_exit_interpreter();
        return_ACPI_STATUS(status);
 }
 
index 3aa91625fca7c49765566a8579d4a87e05527506..1ce26d9f8ff66057c4b3cba078824ae596212a38 100644 (file)
@@ -537,9 +537,11 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
 
                        /* Either the method parse or actual execution failed */
 
+                       acpi_ex_exit_interpreter();
                        ACPI_ERROR_METHOD("Method parse/execution failed",
                                          walk_state->method_node, NULL,
                                          status);
+                       acpi_ex_enter_interpreter();
 
                        /* Check for possible multi-thread reentrancy problem */