Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752713AbdLLVwd convert rfc822-to-8bit (ORCPT ); Tue, 12 Dec 2017 16:52:33 -0500 Received: from mga05.intel.com ([192.55.52.43]:23229 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752580AbdLLVwY (ORCPT ); Tue, 12 Dec 2017 16:52:24 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,395,1508828400"; d="scan'208";a="2024039" From: "Moore, Robert" To: Vadim Lomovtsev , "Wysocki, Rafael J" , "lenb@kernel.org" , "linux-acpi@vger.kernel.org" , "devel@acpica.org" , "linux-kernel@vger.kernel.org" CC: "vadim.lomovtsev@cavium.com" , "Schmauss, Erik" Subject: RE: [PATCH] acpi: acpica: add acpi status check prior walking through namespace Thread-Topic: [PATCH] acpi: acpica: add acpi status check prior walking through namespace Thread-Index: AQHTc2I4QRUHmqFo+0mI7zNcJ6i/LqNAP8kQ Date: Tue, 12 Dec 2017 21:52:21 +0000 Message-ID: <94F2FBAB4432B54E8AACC7DFDE6C92E3B74FBD84@ORSMSX110.amr.corp.intel.com> References: <1513094360-1414-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> <1513094360-1414-2-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> In-Reply-To: <1513094360-1414-2-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTRmNjI5NTYtM2ViMS00MjJlLTkyNmUtODZiMDZkODQ0ZTM5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ5ZDE5dkw0bm9CNE0rSGk4MzVjdzVCM3dNeU1QV3ZFQ09jcjVodVZJT0dnM21Db20rYmVSQllRR0JRNWZcL2dlWiJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.22.254.140] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1982 Lines: 56 Another way to look at this is that the kernel should not be calling ACPI interfaces if ACPI is disabled. > -----Original Message----- > From: Vadim Lomovtsev [mailto:Vadim.Lomovtsev@caviumnetworks.com] > Sent: Tuesday, December 12, 2017 7:59 AM > To: Moore, Robert ; Zheng, Lv > ; Wysocki, Rafael J ; > lenb@kernel.org; linux-acpi@vger.kernel.org; devel@acpica.org; linux- > kernel@vger.kernel.org > Cc: vadim.lomovtsev@cavium.com > Subject: [PATCH] acpi: acpica: add acpi status check prior walking > through namespace > > From: Vadim Lomovtsev > > While having kernel built with ACPI support enabled and booted over FDT, > the ltp_acpi test from LTP suite causes kernel crash while calling > acpi_ns_walk_namespace(). The acpi_get_devices is high level wrapper for > it, so we need to protect kernel from crashes by adding acpi status > check before walking through namespace which is not loaded because of > acpi is disabled. > > Signed-off-by: Vadim Lomovtsev > --- > drivers/acpi/acpica/nsxfeval.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/acpi/acpica/nsxfeval.c > b/drivers/acpi/acpica/nsxfeval.c index 783f4c8..e0eb9ae 100644 > --- a/drivers/acpi/acpica/nsxfeval.c > +++ b/drivers/acpi/acpica/nsxfeval.c > @@ -52,6 +52,8 @@ > #define _COMPONENT ACPI_NAMESPACE > ACPI_MODULE_NAME("nsxfeval") > > +extern int acpi_disabled; > + > /* Local prototypes */ > static void acpi_ns_resolve_references(struct acpi_evaluate_info > *info); > > @@ -812,6 +814,11 @@ static void acpi_ns_resolve_references(struct > acpi_evaluate_info *info) > > ACPI_FUNCTION_TRACE(acpi_get_devices); > > + /* check if ACPI disabled to prevent kernel crash later */ > + if (acpi_disabled) { > + return_ACPI_STATUS(AE_NOT_CONFIGURED); > + } > + > /* Parameter validation */ > > if (!user_function) { > -- > 1.8.3.1