Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp609489pxb; Tue, 15 Feb 2022 23:41:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxv7abglcTJNHOMC0Dc8HNPIW4XbPGubDs3cpIa3clm+vIvkgKU76wjbWehsrYko1zwAb0e X-Received: by 2002:a17:903:32cc:b0:14f:2fcd:ccd8 with SMTP id i12-20020a17090332cc00b0014f2fcdccd8mr1215878plr.138.1644997264614; Tue, 15 Feb 2022 23:41:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644997264; cv=none; d=google.com; s=arc-20160816; b=IlggJOEgbu4O/2sdsoo150T1oE1VQer7w6HXoHQpw5+VJmASYIXK/6U/lhbTWPaiD0 pK+4WQ1Hu1lEKK7OZpYikwPZ2syHjt9nlkizamS7CHelQOnWFW6YZZ0hGCd3QCddfkYm bhlXOv0a+DGcCgLwYLd8ELCeuuUvdWTyFqWFhxcd+mdXZz6tvF+yCnCsERQKF5Cm3nee bXZ2R3Khpk3Ge+VwBoyw7a3zbkDnalXI5JiLFPHYfkz/OSjXMGhXTqF+OmERYPU698gK j3JTweUdmFN/kdGzChZEeBgKG/THoADwJ5aeEIsoDnBp63We+ym3eAVPQw46Ufxi84+i epyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OvKU87ZuZVBNlgRFBm0eK1EY/vXmrbJUx8OOhh6O4Fw=; b=00ALrIV83rimSMWAXk0hsyXzW0UjtUWIm7RsHLsZknHTu75dUe9KiK4vwCKUYpV/Ba uTMaTf71dRpvuKMg8Tt7ZHrFESqGm6yeRGv5cknFkehZxFwm8elgnJTsmpROY9uu6Uf7 v1j7NgapvUzWbBfUrsxAUmRhlMXx0ZryoIJ9Cp4IAvugNyuwxH22shqoHEEm7fvqnhhe rpIYDEsjNaun9K8Sus8EZQPdEC/MSOuEMmdOFN82MICU2fL8xziq0WKjT7vrZRAhKdPC 5L9flspedoYHE9U2xmAS+yyfptfU00FvDXfkqfmfXB8snqBUabTi095XRUxW/oNCrMCe ivyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VNEOZaNj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i4si33035245pfr.238.2022.02.15.23.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 23:41:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VNEOZaNj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6BC6D2C5A9F; Tue, 15 Feb 2022 23:05:50 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbiBPG0a (ORCPT + 99 others); Wed, 16 Feb 2022 01:26:30 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:48680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbiBPG02 (ORCPT ); Wed, 16 Feb 2022 01:26:28 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F35D1D6869 for ; Tue, 15 Feb 2022 22:26:11 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id c10so1338894pfv.8 for ; Tue, 15 Feb 2022 22:26:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OvKU87ZuZVBNlgRFBm0eK1EY/vXmrbJUx8OOhh6O4Fw=; b=VNEOZaNjA8eSHMhScLGO1U7A14vrcKc3V+O17T0GPa4CA7I0gu8ccEAHfW/N/i8FEZ worTZCDDMQ0FYDxMqxuc0U1mf+F9uAEEBWmuMq0TfXN0GSQ7DaDNA7fSHtzUBC6w26Iw v2ZACq1ukUzkORWOFfKm7Q6XWsDy5CkdRfPaVc7IZCS7ssRpCA5mD4kqJHhbI/m26N4c qE5qXRQo3YG15e/CBehLRHNN0P40WBx5XXe6N8elYULUv+zylyn8RcYEjuNIg8xk5mXH cEnyKxxF+TVvNIQF3ZTcBbCqUd1VoAWn+tpUpNsbjho2ZI3txmXc6WcG+bnO/VHqS7T9 skfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OvKU87ZuZVBNlgRFBm0eK1EY/vXmrbJUx8OOhh6O4Fw=; b=faKP/ulJi7NCaY5WUGLDJDVdy+iN3jAwPagkc9/IX0j3bat9KzcZANajIX0JdIYY9R J7uUP8LcBtDFklvZDLcHPtW+5jZqRZheUD+FgFwFdOg11XSgKtxYp05K1E4ZxXG+f1qo hwo9nAb9J7QhGwB8e570uAOsEmDLR/fKvQ5XUabioAHiicDjMWDn0bVF6JJeh6h87ZlQ XbylMC9V5xdHmitvs1qNsSWTQzjyaRmyi6d78h5kyIsDj5Iv9IAFWmZgy382o2Twm9NL h5JNyjp3NBxU+an2EV2zUnf222eoz1qGkAERE2pyM94IzmBEJe8VPSIvrFyXayQYAu+E tysw== X-Gm-Message-State: AOAM530ieohfuDn8PX/GfDXQpoIdiMd1cs/m9zzqXx5vto7e6c2kw8YF Qc3MGQqRQ5+PpilFF0dW4GY= X-Received: by 2002:a63:f20d:0:b0:372:c9bf:eaad with SMTP id v13-20020a63f20d000000b00372c9bfeaadmr1083890pgh.308.1644992769244; Tue, 15 Feb 2022 22:26:09 -0800 (PST) Received: from ubuntu-server.local ([2600:1700:3ec7:421f:fd1e:ea7b:d4f8:959b]) by smtp.googlemail.com with ESMTPSA id k4sm11321864pff.39.2022.02.15.22.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 22:26:08 -0800 (PST) From: Tong Zhang To: Benson Leung , Guenter Roeck , linux-kernel@vger.kernel.org Cc: Tong Zhang Subject: [PATCH] platform/chrome: cros_ec: honor acpi=off Date: Tue, 15 Feb 2022 22:26:01 -0800 Message-Id: <20220216062601.779690-1-ztong0001@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org when acpi=off is provided in bootarg, kernel crash with BUG: kernel NULL pointer dereference, address: 0000000000000018 RIP: 0010:acpi_ns_walk_namespace+0x57/0x280 ? acpi_get_devices+0x140/0x140 cros_ec_lpc_init+0x25/0x100 Driver should check if ACPI is disabled before calling acpi_get_devices(), otherwise acpi_walk_namespace() will dereference null pointer since the acpi_gbl_root_node is not initialized. This is a common pattern and should be fixed in ACPI framework to prevent such crash in the future, but since many drivers are already doing explicit check(acpi_disable) we do the same thing here. Signed-off-by: Tong Zhang --- drivers/platform/chrome/cros_ec_lpc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index d6306d2a096f..95412a55ed8d 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -550,6 +550,9 @@ static int __init cros_ec_lpc_init(void) int ret; acpi_status status; + if (acpi_disable) + return -ENODEV; + status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device, &cros_ec_lpc_acpi_device_found, NULL); if (ACPI_FAILURE(status)) -- 2.25.1