Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp819405pxb; Tue, 3 Nov 2020 13:27:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyc9bpy+ZIY5eY3tfisBLzBXpzXzjs9W/IORTKfhW87ttn8TvlmfZfQNpO7r2A0JKMmxOZ0 X-Received: by 2002:a05:6402:10c7:: with SMTP id p7mr23756852edu.34.1604438822438; Tue, 03 Nov 2020 13:27:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438822; cv=none; d=google.com; s=arc-20160816; b=OuKMUFTbFEb3fupRXXu2ivyduTcvvqpLXwJkfDZLR9HoEeI1Zs+5JJWuVHpIMmHYv1 ODgtM/9R3RTrG7Wmc6nEjIL4PYlOZtvy0hyFxC3UIvrqKLOeyq46K0fxX7uQyO4uvrcC aLc1J3yYyq2Opiyf6xu7hwwloKMUKTKE1oB0DpvCkdr6yjflqohkMICXRd2gmNlrE3DB UzhXN7G/3pmstSzLNWpC/3sfvibs+mG5DEgLuw6Seb9dUu5SQxwb2xOV65qDBvJ6pjK9 ieinZVLdlTXMQ+fjd56WtTrA9c2zh+p94IBE19+zyMf6ozU5SDyicO66iRbOHCUjh5LK BTKA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7/BaPf0gIdbzEsb8txosd+HGIRJmoy5JIcUyLhifz0c=; b=dwzLBnjPzR/JmND8/w8X+lDZXtL7/ZJSIV5X2lFtMRF9MfwMijJh5h1e8mDV0tneVh 5sROwM7OXi+NdJzR0bYzhxEPGiwmTZfsvPbaIIVmkzI8kWQ59bdbeAImxvu7apOeTubL h8oeINjrWEgpj2D92JqV+pGceYEDyDaetfxFTnFiHNbi2/kVb017ssws+bBRkURyMjef TTofK+SnYAAM20XWBKAR2OQa1IEXoQ2w7zmnyg8VBSPDtXDnL/WDWuhqoyGifAxIPoc2 2bU2ZTSfHOeaQtt3fSXl5cOv5U0elqRMeoTYpVw5e/pRm39rfaxLAdELIZL2b/AK/t+N kKeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iTnJ95u/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z11si16987ejf.614.2020.11.03.13.26.39; Tue, 03 Nov 2020 13:27:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="iTnJ95u/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388080AbgKCVFw (ORCPT + 99 others); Tue, 3 Nov 2020 16:05:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:44504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388072AbgKCVFu (ORCPT ); Tue, 3 Nov 2020 16:05:50 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 EB878205ED; Tue, 3 Nov 2020 21:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437549; bh=tU0xlHvyDGv6ZJxxBpqUXyPc4mGnxZ5U2rTNVUd3VGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTnJ95u/c2f/yDuAPnxuy1f+iNgpbYYhoaRDm1ETx0yjHNFVxrj3K+YLbyB7iv2mY Y1VEMFu1Nu95/QkTy4p7gQsu4U/NpLk1oQwShoB2AY8lnDyNJu4NbeP21B7BX11qCo JUOi365SfM6dVysNjoZP26Tu3vE+nG2FxM1C9Ykc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hanjun Guo , Jamie Iles , "Rafael J. Wysocki" Subject: [PATCH 4.19 123/191] ACPI: debug: dont allow debugging when ACPI is disabled Date: Tue, 3 Nov 2020 21:36:55 +0100 Message-Id: <20201103203244.772659036@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jamie Iles commit 0fada277147ffc6d694aa32162f51198d4f10d94 upstream. If ACPI is disabled then loading the acpi_dbg module will result in the following splat when lock debugging is enabled. DEBUG_LOCKS_WARN_ON(lock->magic != lock) WARNING: CPU: 0 PID: 1 at kernel/locking/mutex.c:938 __mutex_lock+0xa10/0x1290 Kernel panic - not syncing: panic_on_warn set ... CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc8+ #103 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x4d8 show_stack+0x34/0x48 dump_stack+0x174/0x1f8 panic+0x360/0x7a0 __warn+0x244/0x2ec report_bug+0x240/0x398 bug_handler+0x50/0xc0 call_break_hook+0x160/0x1d8 brk_handler+0x30/0xc0 do_debug_exception+0x184/0x340 el1_dbg+0x48/0xb0 el1_sync_handler+0x170/0x1c8 el1_sync+0x80/0x100 __mutex_lock+0xa10/0x1290 mutex_lock_nested+0x6c/0xc0 acpi_register_debugger+0x40/0x88 acpi_aml_init+0xc4/0x114 do_one_initcall+0x24c/0xb10 kernel_init_freeable+0x690/0x728 kernel_init+0x20/0x1e8 ret_from_fork+0x10/0x18 This is because acpi_debugger.lock has not been initialized as acpi_debugger_init() is not called when ACPI is disabled. Fail module loading to avoid this and any subsequent problems that might arise by trying to debug AML when ACPI is disabled. Fixes: 8cfb0cdf07e2 ("ACPI / debugger: Add IO interface to access debugger functionalities") Reviewed-by: Hanjun Guo Signed-off-by: Jamie Iles Cc: 4.10+ # 4.10+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpi_dbg.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/acpi/acpi_dbg.c +++ b/drivers/acpi/acpi_dbg.c @@ -757,6 +757,9 @@ int __init acpi_aml_init(void) goto err_exit; } + if (acpi_disabled) + return -ENODEV; + /* Initialize AML IO interface */ mutex_init(&acpi_aml_io.lock); init_waitqueue_head(&acpi_aml_io.wait);