summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/psobject.c
diff options
context:
space:
mode:
authorErik Schmauss <erik.schmauss@intel.com>2018-06-01 12:06:43 -0700
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-06-06 08:53:43 +0200
commit5088814a6e931350e5bd29f5d59fa40c6dbbdf10 (patch)
treeb8ac50dc8f6e826eae179409c4cf9a3aa6f5f06a /drivers/acpi/acpica/psobject.c
parent3877b2ccb71356492d8f514a76d764c3ecc1147e (diff)
downloadlinux-stable-5088814a6e931350e5bd29f5d59fa40c6dbbdf10.tar.gz
linux-stable-5088814a6e931350e5bd29f5d59fa40c6dbbdf10.tar.bz2
linux-stable-5088814a6e931350e5bd29f5d59fa40c6dbbdf10.zip
ACPICA: AML parser: attempt to continue loading table after error
This change alters the parser so that the table load does not abort upon an error. Notable changes: If there is an error while parsing an element of the termlist, we will skip parsing the current termlist element and continue parsing to the next opcode in the termlist. If we get an error while parsing the conditional of If/Else/While or the device name of Scope, we will skip the body of the statement all together and pop the parser_state. If we get an error while parsing the base offset and length of an operation region declaration, we will remove the operation region from the namespace. Signed-off-by: Erik Schmauss <erik.schmauss@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/psobject.c')
-rw-r--r--drivers/acpi/acpica/psobject.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c
index 7d9d0151ee54..3138e7a00da8 100644
--- a/drivers/acpi/acpica/psobject.c
+++ b/drivers/acpi/acpica/psobject.c
@@ -12,6 +12,7 @@
#include "acparser.h"
#include "amlcode.h"
#include "acconvert.h"
+#include "acnamesp.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("psobject")
@@ -549,6 +550,21 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
do {
if (*op) {
+ /*
+ * These Opcodes need to be removed from the namespace because they
+ * get created even if these opcodes cannot be created due to
+ * errors.
+ */
+ if (((*op)->common.aml_opcode == AML_REGION_OP)
+ || ((*op)->common.aml_opcode ==
+ AML_DATA_REGION_OP)) {
+ acpi_ns_delete_children((*op)->common.
+ node);
+ acpi_ns_remove_node((*op)->common.node);
+ (*op)->common.node = NULL;
+ acpi_ps_delete_parse_tree(*op);
+ }
+
status2 =
acpi_ps_complete_this_op(walk_state, *op);
if (ACPI_FAILURE(status2)) {
@@ -574,6 +590,20 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
#endif
walk_state->prev_op = NULL;
walk_state->prev_arg_types = walk_state->arg_types;
+
+ if (walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL) {
+ /*
+ * There was something that went wrong while executing code at the
+ * module-level. We need to skip parsing whatever caused the
+ * error and keep going. One runtime error during the table load
+ * should not cause the entire table to not be loaded. This is
+ * because there could be correct AML beyond the parts that caused
+ * the runtime error.
+ */
+ ACPI_ERROR((AE_INFO,
+ "Ignore error and continue table load"));
+ return_ACPI_STATUS(AE_OK);
+ }
return_ACPI_STATUS(status);
}