Skip to content

Commit 8633db6

Browse files
zetalografaeljw
authored andcommitted
ACPICA: Dispatcher: Fix interpreter locking around acpi_ev_initialize_region()
In the code path of acpi_ev_initialize_region(), there is namespace modification code unlocked. This patch tunes the code to make sure such modification are always locked. Fixes: 74f51b8 (ACPICA: Namespace: Fix dynamic table loading issues) Tested-by: Imre Deak <[email protected]> Signed-off-by: Lv Zheng <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 8121aa2 commit 8633db6

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

drivers/acpi/acpica/dsinit.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "acdispat.h"
4747
#include "acnamesp.h"
4848
#include "actables.h"
49+
#include "acinterp.h"
4950

5051
#define _COMPONENT ACPI_DISPATCHER
5152
ACPI_MODULE_NAME("dsinit")
@@ -214,23 +215,17 @@ acpi_ds_initialize_objects(u32 table_index,
214215

215216
/* Walk entire namespace from the supplied root */
216217

217-
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
218-
if (ACPI_FAILURE(status)) {
219-
return_ACPI_STATUS(status);
220-
}
221-
222218
/*
223219
* We don't use acpi_walk_namespace since we do not want to acquire
224220
* the namespace reader lock.
225221
*/
226222
status =
227223
acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
228-
ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object,
229-
NULL, &info, NULL);
224+
0, acpi_ds_init_one_object, NULL, &info,
225+
NULL);
230226
if (ACPI_FAILURE(status)) {
231227
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
232228
}
233-
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
234229

235230
status = acpi_get_table_by_index(table_index, &table);
236231
if (ACPI_FAILURE(status)) {

drivers/acpi/acpica/dsmethod.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,11 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
9999
"Method auto-serialization parse [%4.4s] %p\n",
100100
acpi_ut_get_node_name(node), node));
101101

102-
acpi_ex_enter_interpreter();
103-
104102
/* Create/Init a root op for the method parse tree */
105103

106104
op = acpi_ps_alloc_op(AML_METHOD_OP, obj_desc->method.aml_start);
107105
if (!op) {
108-
status = AE_NO_MEMORY;
109-
goto unlock;
106+
return_ACPI_STATUS(AE_NO_MEMORY);
110107
}
111108

112109
acpi_ps_set_name(op, node->name.integer);
@@ -118,8 +115,7 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
118115
acpi_ds_create_walk_state(node->owner_id, NULL, NULL, NULL);
119116
if (!walk_state) {
120117
acpi_ps_free_op(op);
121-
status = AE_NO_MEMORY;
122-
goto unlock;
118+
return_ACPI_STATUS(AE_NO_MEMORY);
123119
}
124120

125121
status = acpi_ds_init_aml_walk(walk_state, op, node,
@@ -128,7 +124,7 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
128124
if (ACPI_FAILURE(status)) {
129125
acpi_ds_delete_walk_state(walk_state);
130126
acpi_ps_free_op(op);
131-
goto unlock;
127+
return_ACPI_STATUS(status);
132128
}
133129

134130
walk_state->descending_callback = acpi_ds_detect_named_opcodes;
@@ -138,8 +134,6 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
138134
status = acpi_ps_parse_aml(walk_state);
139135

140136
acpi_ps_delete_parse_tree(op);
141-
unlock:
142-
acpi_ex_exit_interpreter();
143137
return_ACPI_STATUS(status);
144138
}
145139

drivers/acpi/acpica/dswload2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,9 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
607607
}
608608
}
609609

610-
acpi_ex_exit_interpreter();
611610
status =
612611
acpi_ev_initialize_region
613612
(acpi_ns_get_attached_object(node), FALSE);
614-
acpi_ex_enter_interpreter();
615613

616614
if (ACPI_FAILURE(status)) {
617615
/*

drivers/acpi/acpica/evrgnini.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "accommon.h"
4646
#include "acevents.h"
4747
#include "acnamesp.h"
48+
#include "acinterp.h"
4849

4950
#define _COMPONENT ACPI_EVENTS
5051
ACPI_MODULE_NAME("evrgnini")
@@ -597,9 +598,11 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
597598
}
598599
}
599600

601+
acpi_ex_exit_interpreter();
600602
status =
601603
acpi_ev_execute_reg_method(region_obj,
602604
ACPI_REG_CONNECT);
605+
acpi_ex_enter_interpreter();
603606

604607
if (acpi_ns_locked) {
605608
status =

drivers/acpi/acpica/nsload.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
137137
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
138138
"**** Begin Table Object Initialization\n"));
139139

140+
acpi_ex_enter_interpreter();
140141
status = acpi_ds_initialize_objects(table_index, node);
142+
acpi_ex_exit_interpreter();
141143

142144
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
143145
"**** Completed Table Object Initialization\n"));

0 commit comments

Comments
 (0)