]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
ACPICA: AML Parser: skip opcodes that open a scope upon parse failure
authorErik Schmauss <erik.schmauss@intel.com>
Fri, 10 Aug 2018 21:42:58 +0000 (14:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Sep 2018 08:32:36 +0000 (10:32 +0200)
commit 4a7c94c721074eafb27298d93dbcc339aa28e745 upstream.

This change skips the entire length of opcodes that open a scope
(Device, Scope, Processor, etc) if the creation of the op fails. The
failure could be caused by various errors including AE_ALREADY_EXISTS
and AE_NOT_FOUND.

Reported-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Cc: 4.17+ <stable@vger.kernel.org> # 4.17+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/acpica/psloop.c

index 44f35ab3347d1a57aded2402e6e386c4d792d759..0f0bdc9d24c66ec8d55fab3c57aa091df6f87e1b 100644 (file)
@@ -22,6 +22,7 @@
 #include "acdispat.h"
 #include "amlcode.h"
 #include "acconvert.h"
+#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_PARSER
 ACPI_MODULE_NAME("psloop")
@@ -527,12 +528,18 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                                if (ACPI_FAILURE(status)) {
                                        return_ACPI_STATUS(status);
                                }
-                               if (walk_state->opcode == AML_SCOPE_OP) {
+                               if (acpi_ns_opens_scope
+                                   (acpi_ps_get_opcode_info
+                                    (walk_state->opcode)->object_type)) {
                                        /*
-                                        * If the scope op fails to parse, skip the body of the
-                                        * scope op because the parse failure indicates that the
-                                        * device may not exist.
+                                        * If the scope/device op fails to parse, skip the body of
+                                        * the scope op because the parse failure indicates that
+                                        * the device may not exist.
                                         */
+                                       ACPI_ERROR((AE_INFO,
+                                                   "Skip parsing opcode %s",
+                                                   acpi_ps_get_opcode_name
+                                                   (walk_state->opcode)));
                                        walk_state->parser_state.aml =
                                            walk_state->aml + 1;
                                        walk_state->parser_state.aml =
@@ -540,8 +547,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                                            (&walk_state->parser_state);
                                        walk_state->aml =
                                            walk_state->parser_state.aml;
-                                       ACPI_ERROR((AE_INFO,
-                                                   "Skipping Scope block"));
                                }
 
                                continue;