diff options
author | Lv Zheng <lv.zheng@intel.com> | 2015-10-18 22:25:42 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-10-21 20:05:05 -0400 |
commit | 086ab742ac97b45ee64507b32b3d1ecbdbc56b39 (patch) | |
tree | ee5fec88e0766e3452f6b21ca20c2c0cfc0a26a4 | |
parent | af08f9cc5073eee875016d28730c99ec86da4198 (diff) |
ACPICA: Debugger: Fix "terminate" command by cleaning up subsystem shutdown logic
ACPICA commit 7e823714911480be47e310fb1b3590d289b9fd99
Segmentation fault can be seen for executing the "terminate" command. This
is because acpi_ut_subsystem_shutdown() is errnously called multiple times.
This patch cleans up acpi_ut_subsystem_shutdown() logics to fix this
issue. Lv Zheng.
Link: https://github.com/acpica/acpica/commit/7e823714
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpica/dbinput.c | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/utinit.c | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxface.c | 13 |
3 files changed, 15 insertions, 14 deletions
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c index f8cddd682af2..0480254437f1 100644 --- a/drivers/acpi/acpica/dbinput.c +++ b/drivers/acpi/acpica/dbinput.c | |||
@@ -1074,6 +1074,7 @@ acpi_db_command_dispatch(char *input_buffer, | |||
1074 | * re-creating the semaphores! | 1074 | * re-creating the semaphores! |
1075 | */ | 1075 | */ |
1076 | 1076 | ||
1077 | acpi_gbl_db_terminate_loop = TRUE; | ||
1077 | /* acpi_initialize (NULL); */ | 1078 | /* acpi_initialize (NULL); */ |
1078 | break; | 1079 | break; |
1079 | 1080 | ||
@@ -1151,7 +1152,7 @@ void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context) | |||
1151 | acpi_status status = AE_OK; | 1152 | acpi_status status = AE_OK; |
1152 | acpi_status Mstatus; | 1153 | acpi_status Mstatus; |
1153 | 1154 | ||
1154 | while (status != AE_CTRL_TERMINATE) { | 1155 | while (status != AE_CTRL_TERMINATE && !acpi_gbl_db_terminate_loop) { |
1155 | acpi_gbl_method_executing = FALSE; | 1156 | acpi_gbl_method_executing = FALSE; |
1156 | acpi_gbl_step_to_next_call = FALSE; | 1157 | acpi_gbl_step_to_next_call = FALSE; |
1157 | 1158 | ||
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index d8699df8914c..ccd0745f011e 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
@@ -282,6 +282,19 @@ void acpi_ut_subsystem_shutdown(void) | |||
282 | { | 282 | { |
283 | ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); | 283 | ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); |
284 | 284 | ||
285 | /* Just exit if subsystem is already shutdown */ | ||
286 | |||
287 | if (acpi_gbl_shutdown) { | ||
288 | ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated")); | ||
289 | return_VOID; | ||
290 | } | ||
291 | |||
292 | /* Subsystem appears active, go ahead and shut it down */ | ||
293 | |||
294 | acpi_gbl_shutdown = TRUE; | ||
295 | acpi_gbl_startup_flags = 0; | ||
296 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); | ||
297 | |||
285 | #ifndef ACPI_ASL_COMPILER | 298 | #ifndef ACPI_ASL_COMPILER |
286 | 299 | ||
287 | /* Close the acpi_event Handling */ | 300 | /* Close the acpi_event Handling */ |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index f183daf938b7..a6b0eb034fc0 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -67,19 +67,6 @@ acpi_status __init acpi_terminate(void) | |||
67 | 67 | ||
68 | ACPI_FUNCTION_TRACE(acpi_terminate); | 68 | ACPI_FUNCTION_TRACE(acpi_terminate); |
69 | 69 | ||
70 | /* Just exit if subsystem is already shutdown */ | ||
71 | |||
72 | if (acpi_gbl_shutdown) { | ||
73 | ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated")); | ||
74 | return_ACPI_STATUS(AE_OK); | ||
75 | } | ||
76 | |||
77 | /* Subsystem appears active, go ahead and shut it down */ | ||
78 | |||
79 | acpi_gbl_shutdown = TRUE; | ||
80 | acpi_gbl_startup_flags = 0; | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); | ||
82 | |||
83 | /* Shutdown and free all resources */ | 70 | /* Shutdown and free all resources */ |
84 | 71 | ||
85 | acpi_ut_subsystem_shutdown(); | 72 | acpi_ut_subsystem_shutdown(); |