Commit 50b77eda authored by Lin Ming's avatar Lin Ming Committed by Len Brown

ACPICA: Fix possible memory leak for Scope ASL operator

Using Scope(\) to change the scope to the root could cause a
single object memory leak.
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 74d3ec77
...@@ -639,6 +639,19 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -639,6 +639,19 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
break; break;
case AML_SCOPE_OP: case AML_SCOPE_OP:
/* Special case for Scope(\) -> refers to the Root node */
if (op && (op->named.node == acpi_gbl_root_node)) {
node = op->named.node;
status =
acpi_ds_scope_stack_push(node, object_type,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
} else {
/* /*
* The Path is an object reference to an existing object. * The Path is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up * Don't enter the name into the namespace, but look it up
...@@ -647,19 +660,22 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, ...@@ -647,19 +660,22 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
status = status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr, acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
object_type, ACPI_IMODE_EXECUTE, object_type, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_NS_SEARCH_PARENT, walk_state,
&(node));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
#ifdef ACPI_ASL_COMPILER #ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
status = AE_OK; status = AE_OK;
} else { } else {
ACPI_ERROR_NAMESPACE(buffer_ptr, status); ACPI_ERROR_NAMESPACE(buffer_ptr,
status);
} }
#else #else
ACPI_ERROR_NAMESPACE(buffer_ptr, status); ACPI_ERROR_NAMESPACE(buffer_ptr, status);
#endif #endif
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
}
/* /*
* We must check to make sure that the target is * We must check to make sure that the target is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment