- patches.apparmor/remove_suid_new_case_in_2.6.22.diff: Merge fix.
[linux-flexiantxendom0-3.2.10.git] / drivers / acpi / dispatcher / dsmethod.c
index 1683e5c..1cbe619 100644 (file)
@@ -231,8 +231,10 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
                 * Obtain the method mutex if necessary. Do not acquire mutex for a
                 * recursive call.
                 */
-               if (acpi_os_get_thread_id() !=
-                   obj_desc->method.mutex->mutex.owner_thread_id) {
+               if (!walk_state ||
+                   !obj_desc->method.mutex->mutex.owner_thread ||
+                   (walk_state->thread !=
+                    obj_desc->method.mutex->mutex.owner_thread)) {
                        /*
                         * Acquire the method mutex. This releases the interpreter if we
                         * block (and reacquires it before it returns)
@@ -246,14 +248,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
                        }
 
                        /* Update the mutex and walk info and save the original sync_level */
-                       obj_desc->method.mutex->mutex.owner_thread_id =
-                               acpi_os_get_thread_id();
 
                        if (walk_state) {
                                obj_desc->method.mutex->mutex.
                                    original_sync_level =
                                    walk_state->thread->current_sync_level;
 
+                               obj_desc->method.mutex->mutex.owner_thread =
+                                   walk_state->thread;
                                walk_state->thread->current_sync_level =
                                    obj_desc->method.sync_level;
                        } else {
@@ -567,7 +569,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
 
                        acpi_os_release_mutex(method_desc->method.mutex->mutex.
                                              os_mutex);
-                       method_desc->method.mutex->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED;
+                       method_desc->method.mutex->mutex.owner_thread = NULL;
                }
        }