Skip to content

Commit 73c2a01

Browse files
Schmauss, Erikrafaeljw
authored andcommitted
ACPICA: AML Parser: ignore dispatcher error status during table load
The dispatcher and the executer process the parse nodes During table load. Error status from the evaluation confuses the AML parser. This results in the parser failing to complete parsing of the current scope op which becomes problematic. For the incorrect AML below, _ADR never gets created. definition_block(...) { Scope (\_SB) { Device (PCI0){...} Name (OBJ1, 0x0) OBJ1 = PCI0 + 5 // Results in an operand error. } // \_SB not closed // parser looks for \_SB._SB.PCI0, results in AE_NOT_FOUND error // Entire scope block gets skipped. Scope (\_SB.PCI0) { Name (_ADR, 0x0) } } Fix the above error by properly completing the initial \_SB scope after an error by clearing errors that occur during table load. In the above case, this means that OBJ1 = PIC0 + 5 is skipped. Fixes: 5088814 (ACPICA: AML parser: attempt to continue loading table after error) Link: https://bugzilla.kernel.org/show_bug.cgi?id=200363 Tested-by: Bastien Nocera <[email protected]> Signed-off-by: Erik Schmauss <[email protected]> Cc: 4.17+ <[email protected]> # 4.17+ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent d72e90f commit 73c2a01

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/acpi/acpica/psloop.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,18 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
497497
status =
498498
acpi_ps_create_op(walk_state, aml_op_start, &op);
499499
if (ACPI_FAILURE(status)) {
500+
/*
501+
* ACPI_PARSE_MODULE_LEVEL means that we are loading a table by
502+
* executing it as a control method. However, if we encounter
503+
* an error while loading the table, we need to keep trying to
504+
* load the table rather than aborting the table load. Set the
505+
* status to AE_OK to proceed with the table load.
506+
*/
507+
if ((walk_state->
508+
parse_flags & ACPI_PARSE_MODULE_LEVEL)
509+
&& status == AE_ALREADY_EXISTS) {
510+
status = AE_OK;
511+
}
500512
if (status == AE_CTRL_PARSE_CONTINUE) {
501513
continue;
502514
}
@@ -694,6 +706,20 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
694706
acpi_ps_next_parse_state(walk_state, op, status);
695707
if (status == AE_CTRL_PENDING) {
696708
status = AE_OK;
709+
} else
710+
if ((walk_state->
711+
parse_flags & ACPI_PARSE_MODULE_LEVEL)
712+
&& ACPI_FAILURE(status)) {
713+
/*
714+
* ACPI_PARSE_MODULE_LEVEL means that we are loading a table by
715+
* executing it as a control method. However, if we encounter
716+
* an error while loading the table, we need to keep trying to
717+
* load the table rather than aborting the table load. Set the
718+
* status to AE_OK to proceed with the table load. If we get a
719+
* failure at this point, it means that the dispatcher got an
720+
* error while processing Op (most likely an AML operand error.
721+
*/
722+
status = AE_OK;
697723
}
698724
}
699725

0 commit comments

Comments
 (0)