diff options
Diffstat (limited to 'drivers/acpi/executer')
-rw-r--r-- | drivers/acpi/executer/exconfig.c | 27 | ||||
-rw-r--r-- | drivers/acpi/executer/exfield.c | 5 | ||||
-rw-r--r-- | drivers/acpi/executer/exnames.c | 7 | ||||
-rw-r--r-- | drivers/acpi/executer/exoparg1.c | 11 |
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 | ||
429 | cleanup: | 438 | cleanup: |
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 | ||
128 | cleanup: | 128 | cleanup: |
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 | } |