Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752707AbdLLP7q (ORCPT ); Tue, 12 Dec 2017 10:59:46 -0500 Received: from mail-dm3nam03on0060.outbound.protection.outlook.com ([104.47.41.60]:59712 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752007AbdLLP7j (ORCPT ); Tue, 12 Dec 2017 10:59:39 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Vadim.Lomovtsev@cavium.com; From: Vadim Lomovtsev To: robert.moore@intel.com, lv.zheng@intel.com, rafael.j.wysocki@intel.com, 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 Date: Tue, 12 Dec 2017 07:59:20 -0800 Message-Id: <1513094360-1414-2-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1513094360-1414-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> References: <1513094360-1414-1-git-send-email-Vadim.Lomovtsev@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: CY4PR1201CA0017.namprd12.prod.outlook.com (10.172.75.27) To CY4PR07MB2998.namprd07.prod.outlook.com (10.172.116.12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f119cf1c-6d5a-4fdf-b0a2-08d5417958ba X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307);SRVR:CY4PR07MB2998; X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2998;3:gPmGZOYgvGCkpaWBpjrZ0MD2/jFy5l3ZEmYnaaERxHiU5FGV57y5X3ZOXplTJjJz+0jbAUdooFw4uZXU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j+D+M+iwZ0a6N+x4agyiCUz09SH6CAXWAD3WPp5m1Hn6U0sJRFrPRToCwvWIKPO8qpLgrz7f4WaWKUSdzDia8bYg4GzIU+qgalgwt1Fq5UlE7UX8ECnX2+2G5pMqGZxgCatcGLJZ/C54dMkUsukvwI4bKLIJjulVNuGIm8oR4ZwIzasb2+cuSvJ5vOuunU5rqK7+7MpSQqFEpHJbhX1ptnSHekLmSM0/bp9+omO9YP1xPaGiRHdNGMOKQEzTFY1zamSS7emoQgCqpyXEYKF341qxRGCJjqR+p5UTbrPzWZtqgf763Ghr5zg5sou5IPoWwLWI944sKyIcCYQXGjI5ELsguAkmNqpOfMrks/Hu/4HSFZP8Y=;4:UYPr8iD/R3VWqoZZEbhxW1gcYONvlIn8Vi4BhkMEynjhia3LU43hPuXQ0vzDl2Q5AyTswPwEjl9YL9KinZC2scbRVPGamkgF0BB4SgT457jWFJhA1LTmv52g/3WhEt/shvMe1UL+HhpFtpsvBwph45NgwY1FvfWmk6qw7zEEqAjGiGJXjUeqU3bCRIbUN/o/Jqn7nXywOqI3AARPV1Sg+KXKvb1XMF+h+08twZRA5cYPJOGuvocAq/O3YOw+pBsHGDXyx5/PVUhy2QdoOFJEpg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(3002001)(3231023)(10201501046)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123564025)(6072148)(201708071742011);SRVR:CY4PR07MB2998;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CY4PR07MB2998; X-Forefront-PRVS: 051900244E X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(376002)(366004)(346002)(189003)(199004)(25786009)(6486002)(53936002)(2950100002)(42882006)(305945005)(575784001)(107886003)(105586002)(69596002)(316002)(7736002)(97736004)(16586007)(6512007)(52116002)(16526018)(68736007)(8936002)(106356001)(6666003)(50226002)(4326008)(53416004)(51416003)(47776003)(66066001)(478600001)(50466002)(8676002)(2906002)(76176011)(6116002)(81166006)(72206003)(3846002)(48376002)(59450400001)(5660300001)(81156014)(36756003)(6506006);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2998;H:localhost.localdomain.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR07MB2998;23:5ryQ3gQyZmLe3FnlM7JzeEOXTKyDgT18mEjhiGi3K?= =?us-ascii?Q?3PDP7gtlA68ImrAjZq8V7fEkybIOVtKYAb5l7/7Tyd78Zkxk3ctF3NOvtD5+?= =?us-ascii?Q?cJtUAO0haChoSxvY12h5qDLAUVs4KAAAeTWcvjgGDM8Bxm/szSjdRmTzlIsk?= =?us-ascii?Q?XTUJYwJMXYBugpag7mH4W+5/VsjiLxjFnygj2qMJh1YA1hgOTsFVhlMlDQC+?= =?us-ascii?Q?Ef0Py2mYEnDn9GFvh4Ow9AIFp1+MO7qZ3KvEhYEUy4iyAZXxoc6Bl4VRvPIr?= =?us-ascii?Q?QoGgLGBqw4feDk3Vth2rxBKxBJ19v4n4PQPU0cyYaL/QUoMZZ0YB8PGy0qCs?= =?us-ascii?Q?8XuZW1GQK/hXbk/PpS6x1iNSA18NwiCeb7Zcc5i+XTP8wa9w7x/Qb8vzxQfk?= =?us-ascii?Q?OFW3TFyLLSdVhM5lyyKO6houbEK8+Qd8V87LtXHCie5dVsRbwQV24DfnOir1?= =?us-ascii?Q?DpG19gCB932gnHp1UpbQQENLBzjK4P5bVXe3SwTPoq/iFMOYRXzWbZbZfZbF?= =?us-ascii?Q?kQzuQmxdGcb+KqIUxLPmeFSy6l9mUoOMlU6UZe0usb0tJNmCA/FgqEqEFfmb?= =?us-ascii?Q?8ndI+XLZ8zZiaJxP+/68bl9i+YDtLiLL6nVFh8ypcqiQBrhpwmdkBWCxQGd3?= =?us-ascii?Q?3OT6+JvZzY7hNcmRxxnHzKQvQzS1ubbZGylDF4YVX1blczxv4tsXExcMckf1?= =?us-ascii?Q?vqVeXmKue5+AjxjarlC7XQCn0gLdXox238grflHHSUxUUwbb20B6fMtiZLb4?= =?us-ascii?Q?EN/ywGHkbvYKR1fv57RnF7N95r6NvMgHNnhhCU9Af3o+MVcddQsrHr2nc7h6?= =?us-ascii?Q?ewd0qytsaEWnLoEuKe8BEAchX/sLvVPcj4fAACBXIBcZJdI7Urv2FCNm41yX?= =?us-ascii?Q?Inen45CUrK8N0fZhV9qkfDJTW4d+NJmisE6XMVUpBzU0kwlpv5i74La3q4md?= =?us-ascii?Q?Xx5kGp/muyNzKhi/ZHTowAfuQJG6tfIbIeyKpgq9AYA45oPVw7JXbeVvzz+s?= =?us-ascii?Q?+7OO4sR65wemQhCztum+yQn5dkYiZym7dNwMkr9KtsQT0l3dKplcAWV/xSeo?= =?us-ascii?Q?EeBb9QDcXrMx1tmxEjjsd0ZtT/od6TwE7WEYXOUZBB7SdOj4lfd2n026kZsk?= =?us-ascii?Q?QqGxIs6O7o=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2998;6:nW0fP+VjUCJgPSdY9vL52p/KnhALGC6zXRf0ljgiPx7BfZz7efPnWAiCDdIlYUUWQNwiFcNrlUBlFrL2jgePVBN5qgJkIdxgPErGG6IbJuKR5X2BSa2R+zLjt7rrzV80gP1yZKy6gMVjosjuQy9e13/4rK+oP52eGXNsuZ1J/2mq8VMcKeCY3iFypRUorPt8NM+nqCAm03F5mhxPP9mF/+G12/0dPYx0Ho4PEGGX+oGGRECAXzQcfbDOUrQMLTPAtabIwuDSU1owF/oGMIImUre9ZPw2ysTaOE5d7eIVl8zuQdbsScqOiFfAIy8kuy/aBgp+b47n1L5ox841q6i23mHXmK1Kvx2Psyo+eSeqpO4=;5:1Ft68iv8IVTmdSiOfRale9boupUn6WniXmamzDhk48M0+lCeOOChK0IHEAXiZKoOEa11doZHTsDUjx5rMvFt33F+y2gfoUNULcyHSmbgb9O+bk2uFSZ1xelzzx6PtrpB+qLsVsdwk8/U2xZiRxdwOL7eY7MLMzDdCwy+DUsGrko=;24:aohvEALBBrDUNlqm+kJTpxS6TAbkttyU5zTorGqLitiBvRSo6Lqy2pJ078TYtdHgSKwZMCjkyhwYysnbDOeTWdArG0Pm82AD5HqW1rshlEM=;7:xhe5PueDrW3wz1l5gqNpGNlNagnTmARdX4Tws1Z4I6EuPnLN+MABGTcx5/VM8KEWwadfVkY167qq5rhIoq+aNbwylCHB2hqy5AJQj8QGj9Czxind44SHLdhNTO4SDy1zw+N/epIpeS5Td76w0KOIFoCKymqa/6LMD09X911FjhOiXkSCCRIc+5NqlvGWb6cQjieki+xN6tFZkjy7QXgRRy96EAoJoGdnW4nETKm6PD7d7XF4E2ub8lN7BLR0JVTO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2017 15:59:37.4990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f119cf1c-6d5a-4fdf-b0a2-08d5417958ba X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2998 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1305 Lines: 41 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