From patchwork Mon Jul 10 07:24:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9832439 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9822360318 for ; Mon, 10 Jul 2017 07:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 872D126E96 for ; Mon, 10 Jul 2017 07:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BC16274B4; Mon, 10 Jul 2017 07:24:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15A4526E96 for ; Mon, 10 Jul 2017 07:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752491AbdGJHYU (ORCPT ); Mon, 10 Jul 2017 03:24:20 -0400 Received: from mga02.intel.com ([134.134.136.20]:63493 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752427AbdGJHYU (ORCPT ); Mon, 10 Jul 2017 03:24:20 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2017 00:24:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,339,1496127600"; d="scan'208";a="123157557" Received: from lvzheng-moblsp3.sh.intel.com ([10.239.159.55]) by orsmga005.jf.intel.com with ESMTP; 10 Jul 2017 00:24:04 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , linux-acpi@vger.kernel.org, Alex James , Bob Moore Subject: [PATCH 13/16] ACPICA: iASL: Ensure that the target node is valid in acpi_ex_create_alias Date: Mon, 10 Jul 2017 15:24:02 +0800 Message-Id: <8b2008a06d325888551846dd7f610cf80c64946c.1499671182.git.lv.zheng@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alex James ACPICA commit 8b14afac65d983610cc5387ede6d85ea5ee075be The following ACPI table contains an invalid target node within the Alias operator: definition_block ("", "SSDT", 1, "Bug", "BugTable", 0x00001000) { Scope (_SB) { Device (DEV0) { Name (_ADR, 1) Device (DEV1) { Alias (_ADR, _ADR) } } } } If an ACPI table contains such an invalid target node in an Alias operator, a segmentation fault will occur when the target node is dereferenced within acpi_ex_create_alias. Add a check for such an invalid target node in acpi_ex_create_alias and return AE_NULL_OBJECT as suggested by @acpibob. Link: https://github.com/acpica/acpica/commit/8b14afac Signed-off-by: Alex James Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/excreate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index d43d7da..6867586 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c @@ -87,6 +87,11 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) target_node->object); } + /* Ensure that the target node is valid */ + if (!target_node) { + return_ACPI_STATUS(AE_NULL_OBJECT); + } + /* * For objects that can never change (i.e., the NS node will * permanently point to the same object), we can simply attach