From patchwork Fri May 19 07:07:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9736009 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 AC7326034C for ; Fri, 19 May 2017 07:08:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 889BB288B5 for ; Fri, 19 May 2017 07:08:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BDD4288B6; Fri, 19 May 2017 07:08:06 +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 0E39728658 for ; Fri, 19 May 2017 07:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbdESHHm (ORCPT ); Fri, 19 May 2017 03:07:42 -0400 Received: from mga11.intel.com ([192.55.52.93]:30445 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750718AbdESHHl (ORCPT ); Fri, 19 May 2017 03:07:41 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 May 2017 00:07:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,362,1491289200"; d="scan'208";a="1132459625" Received: from unknown (HELO Surface-Pro-3.sh.intel.com) ([10.239.159.64]) by orsmga001.jf.intel.com with ESMTP; 19 May 2017 00:07:39 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH v2 1/3] ACPI / EC: Enhance boot EC sanity check Date: Fri, 19 May 2017 15:07:35 +0800 Message-Id: <7c94728bbb598231064f976e8980b44ab1f7464b.1495176440.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 It's reported that some buggy BIOS tables can contain 2 DSDT ECs and one of them is invalid. As we shouldn't evaluate _STA from acpi_ec_dsdt_probe() due to the unknown Windows enumeration order, this patch simply enhances sanity checks in ec_parse_device() as a workaround to skip probing wrong namespace ECs. Link: https://bugzilla.kernel.org/show_bug.cgi?id=195651 Tested-by: Daniel Drake Signed-off-by: Lv Zheng --- drivers/acpi/ec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index c24235d..a920db6 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1362,6 +1362,14 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) ec_parse_io_ports, ec); if (ACPI_FAILURE(status)) return status; + /* + * It's better to evaluate _STA to determine if the device is + * valid. But that could potentially trigger issues related to + * the unknown orders of _INI/_STA evaluations. + * However we can abort due to invalid _CRS information here. + */ + if (ec->data_addr == 0 || ec->command_addr == 0) + return AE_OK; /* Get GPE bit assignment (EC events). */ /* TODO: Add support for _GPE returning a package */