aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-04-10 11:06:39 -0400
committerLen Brown <len.brown@intel.com>2008-04-22 14:29:26 -0400
commit9e41d93c975d403380b7debe05517d630c8e2836 (patch)
tree1f6e7afbca5c54cc16c7e8f88b93f1fccd7ae08a /drivers/acpi
parent7f4ac9f91383a0707de559dc8fbca986fc2d302f (diff)
ACPICA: Fixed a memory leak when Device or Thermal objects referenced in packages
Problem introduced in fix for Package references. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/dispatcher/dsobject.c38
-rw-r--r--drivers/acpi/utilities/utdelete.c8
2 files changed, 26 insertions, 20 deletions
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index fe28b9aeb65c..7556d919bf8b 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -172,7 +172,19 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
172 switch (op->common.node->type) { 172 switch (op->common.node->type) {
173 /* 173 /*
174 * For these types, we need the actual node, not the subobject. 174 * For these types, we need the actual node, not the subobject.
175 * However, the subobject got an extra reference count above. 175 * However, the subobject did not get an extra reference count above.
176 *
177 * TBD: should ex_resolve_node_to_value be changed to fix this?
178 */
179 case ACPI_TYPE_DEVICE:
180 case ACPI_TYPE_THERMAL:
181
182 acpi_ut_add_reference(op->common.node->object);
183
184 /*lint -fallthrough */
185 /*
186 * For these types, we need the actual node, not the subobject.
187 * The subobject got an extra reference count in ex_resolve_node_to_value.
176 */ 188 */
177 case ACPI_TYPE_MUTEX: 189 case ACPI_TYPE_MUTEX:
178 case ACPI_TYPE_METHOD: 190 case ACPI_TYPE_METHOD:
@@ -180,25 +192,15 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
180 case ACPI_TYPE_PROCESSOR: 192 case ACPI_TYPE_PROCESSOR:
181 case ACPI_TYPE_EVENT: 193 case ACPI_TYPE_EVENT:
182 case ACPI_TYPE_REGION: 194 case ACPI_TYPE_REGION:
183 case ACPI_TYPE_DEVICE:
184 case ACPI_TYPE_THERMAL:
185 195
186 obj_desc = 196 /* We will create a reference object for these types below */
187 (union acpi_operand_object *)op->common.
188 node;
189 break; 197 break;
190 198
191 default: 199 default:
192 break; 200 /*
193 } 201 * All other types - the node was resolved to an actual
194 202 * object, we are done.
195 /* 203 */
196 * If above resolved to an operand object, we are done. Otherwise,
197 * we have a NS node, we must create the package entry as a named
198 * reference.
199 */
200 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
201 ACPI_DESC_TYPE_NAMED) {
202 goto exit; 204 goto exit;
203 } 205 }
204 } 206 }
@@ -223,7 +225,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
223 225
224 exit: 226 exit:
225 *obj_desc_ptr = obj_desc; 227 *obj_desc_ptr = obj_desc;
226 return_ACPI_STATUS(AE_OK); 228 return_ACPI_STATUS(status);
227} 229}
228 230
229/******************************************************************************* 231/*******************************************************************************
@@ -743,6 +745,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
743 /* Node was saved in Op */ 745 /* Node was saved in Op */
744 746
745 obj_desc->reference.node = op->common.node; 747 obj_desc->reference.node = op->common.node;
748 obj_desc->reference.object =
749 op->common.node->object;
746 } 750 }
747 751
748 obj_desc->reference.opcode = opcode; 752 obj_desc->reference.opcode = opcode;
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index dcb34f805714..6a763cd85f8c 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -524,10 +524,12 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
524 524
525 case ACPI_TYPE_LOCAL_REFERENCE: 525 case ACPI_TYPE_LOCAL_REFERENCE:
526 /* 526 /*
527 * The target of an Index (a package, string, or buffer) must track 527 * The target of an Index (a package, string, or buffer) or a named
528 * changes to the ref count of the index. 528 * reference must track changes to the ref count of the index or
529 * target object.
529 */ 530 */
530 if (object->reference.opcode == AML_INDEX_OP) { 531 if ((object->reference.opcode == AML_INDEX_OP) ||
532 (object->reference.opcode == AML_INT_NAMEPATH_OP)) {
531 next_object = object->reference.object; 533 next_object = object->reference.object;
532 } 534 }
533 break; 535 break;