aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2018-01-03 18:06:29 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-01-04 19:33:23 -0500
commite7b2005c608aa3dc00cd00a5001415ae04382d13 (patch)
tree398125934025f4c093f539e6226dd87d4d758c04
parentbc4d413a819f9d0764a80a55875a5d7e1f4efed4 (diff)
ACPICA: Fix a couple memory leaks during package object resolution
ACPICA commit 69d4415360446b4a1826dab76ba0cd6d24710ddd A couple memory leaks during resolution of individual package elements. Link: https://github.com/acpica/acpica/commit/69d44153 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Erik Schmauss <erik.schmauss@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/dspkginit.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/acpi/acpica/dspkginit.c b/drivers/acpi/acpica/dspkginit.c
index 6d487edfe2de..5a602b75084e 100644
--- a/drivers/acpi/acpica/dspkginit.c
+++ b/drivers/acpi/acpica/dspkginit.c
@@ -297,8 +297,10 @@ acpi_ds_init_package_element(u8 object_type,
297{ 297{
298 union acpi_operand_object **element_ptr; 298 union acpi_operand_object **element_ptr;
299 299
300 ACPI_FUNCTION_TRACE(ds_init_package_element);
301
300 if (!source_object) { 302 if (!source_object) {
301 return (AE_OK); 303 return_ACPI_STATUS(AE_OK);
302 } 304 }
303 305
304 /* 306 /*
@@ -329,7 +331,7 @@ acpi_ds_init_package_element(u8 object_type,
329 source_object->package.flags |= AOPOBJ_DATA_VALID; 331 source_object->package.flags |= AOPOBJ_DATA_VALID;
330 } 332 }
331 333
332 return (AE_OK); 334 return_ACPI_STATUS(AE_OK);
333} 335}
334 336
335/******************************************************************************* 337/*******************************************************************************
@@ -352,6 +354,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
352 union acpi_generic_state scope_info; 354 union acpi_generic_state scope_info;
353 union acpi_operand_object *element = *element_ptr; 355 union acpi_operand_object *element = *element_ptr;
354 struct acpi_namespace_node *resolved_node; 356 struct acpi_namespace_node *resolved_node;
357 struct acpi_namespace_node *original_node;
355 char *external_path = NULL; 358 char *external_path = NULL;
356 acpi_object_type type; 359 acpi_object_type type;
357 360
@@ -441,6 +444,7 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
441 * will remain as named references. This behavior is not described 444 * will remain as named references. This behavior is not described
442 * in the ACPI spec, but it appears to be an oversight. 445 * in the ACPI spec, but it appears to be an oversight.
443 */ 446 */
447 original_node = resolved_node;
444 status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); 448 status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
445 if (ACPI_FAILURE(status)) { 449 if (ACPI_FAILURE(status)) {
446 return_VOID; 450 return_VOID;
@@ -468,26 +472,27 @@ acpi_ds_resolve_package_element(union acpi_operand_object **element_ptr)
468 */ 472 */
469 case ACPI_TYPE_DEVICE: 473 case ACPI_TYPE_DEVICE:
470 case ACPI_TYPE_THERMAL: 474 case ACPI_TYPE_THERMAL:
471 475 case ACPI_TYPE_METHOD:
472 /* TBD: This may not be necesssary */
473
474 acpi_ut_add_reference(resolved_node->object);
475 break; 476 break;
476 477
477 case ACPI_TYPE_MUTEX: 478 case ACPI_TYPE_MUTEX:
478 case ACPI_TYPE_METHOD:
479 case ACPI_TYPE_POWER: 479 case ACPI_TYPE_POWER:
480 case ACPI_TYPE_PROCESSOR: 480 case ACPI_TYPE_PROCESSOR:
481 case ACPI_TYPE_EVENT: 481 case ACPI_TYPE_EVENT:
482 case ACPI_TYPE_REGION: 482 case ACPI_TYPE_REGION:
483 483
484 /* acpi_ex_resolve_node_to_value gave these an extra reference */
485
486 acpi_ut_remove_reference(original_node->object);
484 break; 487 break;
485 488
486 default: 489 default:
487 /* 490 /*
488 * For all other types - the node was resolved to an actual 491 * For all other types - the node was resolved to an actual
489 * operand object with a value, return the object 492 * operand object with a value, return the object. Remove
493 * a reference on the existing object.
490 */ 494 */
495 acpi_ut_remove_reference(element);
491 *element_ptr = (union acpi_operand_object *)resolved_node; 496 *element_ptr = (union acpi_operand_object *)resolved_node;
492 break; 497 break;
493 } 498 }