Commit 06366c14 authored by Lin Ming's avatar Lin Ming Committed by Len Brown

ACPICA: Fix reference count issues for DdbHandle object

Fix a problem where the DdbHandle could be prematurely deleted,
possibly causing a fault.
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 8c725bf9
...@@ -229,6 +229,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, ...@@ -229,6 +229,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
walk_state); walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
(void)acpi_ex_unload_table(ddb_handle); (void)acpi_ex_unload_table(ddb_handle);
acpi_ut_remove_reference(ddb_handle);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
...@@ -454,6 +456,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, ...@@ -454,6 +456,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* Remove the reference by added by acpi_ex_store above */
acpi_ut_remove_reference(ddb_handle);
/* Invoke table handler if present */ /* Invoke table handler if present */
if (acpi_gbl_table_handler) { if (acpi_gbl_table_handler) {
...@@ -530,8 +536,5 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) ...@@ -530,8 +536,5 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
(void)acpi_tb_release_owner_id(table_index); (void)acpi_tb_release_owner_id(table_index);
acpi_tb_set_table_loaded_flag(table_index, FALSE); acpi_tb_set_table_loaded_flag(table_index, FALSE);
/* Table unloaded, remove a reference to the ddb_handle object */
acpi_ut_remove_reference(ddb_handle);
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
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