Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3412602imu; Sun, 11 Nov 2018 14:29:13 -0800 (PST) X-Google-Smtp-Source: AJdET5f1EMNXeoJn6WO/KKya1UDriLU3SI2/0/G0+Zg2RKJUK3VqgM1MkP1zBz0GI25sOv1k/gW9 X-Received: by 2002:a17:902:104:: with SMTP id 4-v6mr18044532plb.184.1541975352998; Sun, 11 Nov 2018 14:29:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541975352; cv=none; d=google.com; s=arc-20160816; b=ro2aNm3sZMllRXfihjf7xhXtXTfhK0iAKa0tZkXPQ+lxsY8cqxOPtAFUgJngkKOfRi pe1ZCfN/liIq/kTpTX+t3xbluS/lIeTl/qlE4qJNdXpzdkMmCj1U8A2U3Q6OWG92Z5Ba R4ubGaZqG9iVyX/Fe/+pLI8LL6Ke2dKnGWdjcd5KZnyV1nGy33Ecwa6t9djFHTqA2tlP Vc/TWri9KZQ5n4fQGOQq20Xik5ZR+Era3cxTqf+nTTUELBXI2sWkFRc3LdA1xKImM/bw /bqtgXED9eq3H2CXgfymAQ1SRTHkPLhlKhncjebR+t3c7lSwiwZUoownm5UJyjKR7eE8 mFxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hwzmzMflCCtIlqCQWjfdf1X6B4MS7pHykuRYAeJzPno=; b=gSULNwttvwFucPVNQbxTQq+DUPpPI4zLw49IMq89beGM1D0hcjFhst2g3TBu3yhxB6 ku0fChMA/mqWCxbtbIw98qtP3y9PSkmiPWzUIkiVCX4zcPZjPkRejr6VWDoEA9p51Y/T EYt3W1eYoa7R7m3FfP/S/5IoGdbnz2p/TwBkXJm/qNllw829DiJuyxSrC4+Pzp3R92IU IWXegsIkYHCQgm7Axaa77sPMRCj8HbHLTuHk8vFCcs4GE9OKa2Tzp+uuhyqGtDjeI1Om lx9eCuKIBjDRYdsK1J96FnjazbRL/rPfT/pjGMTIJmsm2t6ZABTabnT9Ybo994/UlfZp H10w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rbfx61lR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l70-v6si16038853pfg.136.2018.11.11.14.28.57; Sun, 11 Nov 2018 14:29:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rbfx61lR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730015AbeKLIQ7 (ORCPT + 99 others); Mon, 12 Nov 2018 03:16:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:58446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729914AbeKLIQ4 (ORCPT ); Mon, 12 Nov 2018 03:16:56 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2411F21508; Sun, 11 Nov 2018 22:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975221; bh=zK57b91zsiqv77n+HM5zCCNT3jt5kVr/sBwwg2QtPyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rbfx61lRhRL990587MxSaGIFRPqBKGByGSL62QdiE6QFnd8ms7dZkFkG/0Ugfi2t5 5DOYQKnoZ6HLvch7D+KZ+7yZ2WahYcKbPmMohePPAXNGdegKN69W1MCp00XlanINML qlri2eSuf26EwZvpVUAnzuCSOxfwS/lY1JUjVhOE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erik Schmauss , "Rafael J. Wysocki" Subject: [PATCH 4.19 026/361] ACPICA: AML Parser: fix parse loop to correctly skip erroneous extended opcodes Date: Sun, 11 Nov 2018 14:16:13 -0800 Message-Id: <20181111221623.289947764@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Erik Schmauss commit c64baa3a6fa207d112706bc5e7fd645cd8a8663f upstream. AML opcodes come in two lengths: 1-byte opcodes and 2-byte, extended opcodes. If an error occurs due to illegal opcodes during table load, the AML parser needs to continue loading the table. In order to do this, it needs to skip parsing of the offending opcode and operands associated with that opcode. This change fixes the AML parse loop to correctly skip parsing of incorrect extended opcodes. Previously, only the short opcodes were skipped correctly. Signed-off-by: Erik Schmauss Cc: All applicable Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpica/psloop.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c @@ -417,6 +417,7 @@ acpi_status acpi_ps_parse_loop(struct ac union acpi_parse_object *op = NULL; /* current op */ struct acpi_parse_state *parser_state; u8 *aml_op_start = NULL; + u8 opcode_length; ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state); @@ -540,8 +541,19 @@ acpi_status acpi_ps_parse_loop(struct ac "Skip parsing opcode %s", acpi_ps_get_opcode_name (walk_state->opcode))); + + /* + * Determine the opcode length before skipping the opcode. + * An opcode can be 1 byte or 2 bytes in length. + */ + opcode_length = 1; + if ((walk_state->opcode & 0xFF00) == + AML_EXTENDED_OPCODE) { + opcode_length = 2; + } walk_state->parser_state.aml = - walk_state->aml + 1; + walk_state->aml + opcode_length; + walk_state->parser_state.aml = acpi_ps_get_next_package_end (&walk_state->parser_state);