aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-05-26 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2005-07-13 16:46:34 -0400
commit88ac00f5a841dcfc5c682000f4a6add0add8caac (patch)
tree80dcff8323c6c79e8706f42eb4b7c3884bc03152 /drivers/acpi/executer
parent6f42ccf2fc50ecee8ea170040627f268430c1648 (diff)
ACPICA 20050526 from Bob Moore <robert.moore@intel.com>
Implemented support to execute Type 1 and Type 2 AML opcodes appearing at the module level (not within a control method.) These opcodes are executed exactly once at the time the table is loaded. This type of code was legal up until the release of ACPI 2.0B (2002) and is now supported within ACPI CA in order to provide backwards compatibility with earlier BIOS implementations. This eliminates the "Encountered executable code at module level" warning that was previously generated upon detection of such code. Fixed a problem in the interpreter where an AE_NOT_FOUND exception could inadvertently be generated during the lookup of namespace objects in the second pass parse of ACPI tables and control methods. It appears that this problem could occur during the resolution of forward references to namespace objects. Added the ACPI_MUTEX_DEBUG #ifdef to the acpi_ut_release_mutex function, corresponding to the same the deadlock detection debug code to be compiled out in the normal case, improving mutex performance (and overall subsystem performance) considerably. As suggested by Alexey Starikovskiy. Implemented a handful of miscellaneous fixes for possible memory leaks on error conditions and error handling control paths. These fixes were suggested by FreeBSD and the Coverity Prevent source code analysis tool. Added a check for a null RSDT pointer in acpi_get_firmware_table (tbxfroot.c) to prevent a fault in this error case. Signed-off-by Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer')
-rw-r--r--drivers/acpi/executer/exconfig.c27
-rw-r--r--drivers/acpi/executer/exfield.c5
-rw-r--r--drivers/acpi/executer/exnames.c7
-rw-r--r--drivers/acpi/executer/exoparg1.c11
4 files changed, 33 insertions, 17 deletions
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
index 734b2f24af48..8bfa6effaa0c 100644
--- a/drivers/acpi/executer/exconfig.c
+++ b/drivers/acpi/executer/exconfig.c
@@ -376,16 +376,22 @@ acpi_ex_load_op (
376 */ 376 */
377 status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc); 377 status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
378 if (ACPI_FAILURE (status)) { 378 if (ACPI_FAILURE (status)) {
379 goto cleanup; 379 return_ACPI_STATUS (status);
380 } 380 }
381 381
382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header, 382 table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
383 buffer_desc->buffer.pointer); 383 buffer_desc->buffer.pointer);
384 384
385 /* Sanity check the table length */ 385 /* All done with the buffer_desc, delete it */
386
387 buffer_desc->buffer.pointer = NULL;
388 acpi_ut_remove_reference (buffer_desc);
389
390 /* Sanity check the table length */
386 391
387 if (table_ptr->length < sizeof (struct acpi_table_header)) { 392 if (table_ptr->length < sizeof (struct acpi_table_header)) {
388 return_ACPI_STATUS (AE_BAD_HEADER); 393 status = AE_BAD_HEADER;
394 goto cleanup;
389 } 395 }
390 break; 396 break;
391 397
@@ -413,7 +419,9 @@ acpi_ex_load_op (
413 419
414 status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle); 420 status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
415 if (ACPI_FAILURE (status)) { 421 if (ACPI_FAILURE (status)) {
416 goto cleanup; 422 /* On error, table_ptr was deallocated above */
423
424 return_ACPI_STATUS (status);
417 } 425 }
418 426
419 /* Store the ddb_handle into the Target operand */ 427 /* Store the ddb_handle into the Target operand */
@@ -421,17 +429,14 @@ acpi_ex_load_op (
421 status = acpi_ex_store (ddb_handle, target, walk_state); 429 status = acpi_ex_store (ddb_handle, target, walk_state);
422 if (ACPI_FAILURE (status)) { 430 if (ACPI_FAILURE (status)) {
423 (void) acpi_ex_unload_table (ddb_handle); 431 (void) acpi_ex_unload_table (ddb_handle);
424 }
425 432
426 return_ACPI_STATUS (status); 433 /* table_ptr was deallocated above */
427 434
435 return_ACPI_STATUS (status);
436 }
428 437
429cleanup: 438cleanup:
430 439 if (ACPI_FAILURE (status)) {
431 if (buffer_desc) {
432 acpi_ut_remove_reference (buffer_desc);
433 }
434 else {
435 ACPI_MEM_FREE (table_ptr); 440 ACPI_MEM_FREE (table_ptr);
436 } 441 }
437 return_ACPI_STATUS (status); 442 return_ACPI_STATUS (status);
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index 22c8fa480f60..a690c9250990 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -87,6 +87,9 @@ acpi_ex_read_data_from_field (
87 if (!obj_desc) { 87 if (!obj_desc) {
88 return_ACPI_STATUS (AE_AML_NO_OPERAND); 88 return_ACPI_STATUS (AE_AML_NO_OPERAND);
89 } 89 }
90 if (!ret_buffer_desc) {
91 return_ACPI_STATUS (AE_BAD_PARAMETER);
92 }
90 93
91 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { 94 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
92 /* 95 /*
@@ -182,7 +185,7 @@ exit:
182 if (ACPI_FAILURE (status)) { 185 if (ACPI_FAILURE (status)) {
183 acpi_ut_remove_reference (buffer_desc); 186 acpi_ut_remove_reference (buffer_desc);
184 } 187 }
185 else if (ret_buffer_desc) { 188 else {
186 *ret_buffer_desc = buffer_desc; 189 *ret_buffer_desc = buffer_desc;
187 } 190 }
188 191
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c
index 639f0bd3f6d8..b6ba1a7a677a 100644
--- a/drivers/acpi/executer/exnames.c
+++ b/drivers/acpi/executer/exnames.c
@@ -438,6 +438,13 @@ acpi_ex_get_name_string (
438 status = AE_AML_BAD_NAME; 438 status = AE_AML_BAD_NAME;
439 } 439 }
440 440
441 if (ACPI_FAILURE (status)) {
442 if (name_string) {
443 ACPI_MEM_FREE (name_string);
444 }
445 return_ACPI_STATUS (status);
446 }
447
441 *out_name_string = name_string; 448 *out_name_string = name_string;
442 *out_name_length = (u32) (aml_address - in_aml_address); 449 *out_name_length = (u32) (aml_address - in_aml_address);
443 450
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c
index dbdf8262ba00..ffc61ddeb659 100644
--- a/drivers/acpi/executer/exoparg1.c
+++ b/drivers/acpi/executer/exoparg1.c
@@ -127,15 +127,16 @@ acpi_ex_opcode_0A_0T_1R (
127 127
128cleanup: 128cleanup:
129 129
130 if (!walk_state->result_obj) {
131 walk_state->result_obj = return_desc;
132 }
133
134 /* Delete return object on error */ 130 /* Delete return object on error */
135 131
136 if (ACPI_FAILURE (status)) { 132 if ((ACPI_FAILURE (status)) || walk_state->result_obj) {
137 acpi_ut_remove_reference (return_desc); 133 acpi_ut_remove_reference (return_desc);
138 } 134 }
135 else {
136 /* Save the return value */
137
138 walk_state->result_obj = return_desc;
139 }
139 140
140 return_ACPI_STATUS (status); 141 return_ACPI_STATUS (status);
141} 142}