From patchwork Fri Jul 17 17:59:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 235743 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1927742ilg; Fri, 17 Jul 2020 11:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb8HjoAX/fYCc16nuGL/6d4PadPleu15+wCp+h/oz/yABpa6R4Au6OrB8C681gIEMJEG5P X-Received: by 2002:a50:cf43:: with SMTP id d3mr10846084edk.40.1595008998868; Fri, 17 Jul 2020 11:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595008998; cv=none; d=google.com; s=arc-20160816; b=ztMtUAPL+CgoIxSGf5+7R10K6LL2zoDU2txtpa+8zh9SEVTc902h44SI0uGSOpKTHD r/tfyqTmx5dwaudBYu3YRc+qG3/OoZCqABtNcWL74AYiIjBtMMfVCwfoAFuWhomqdxaH Gx/FMmFDyxj0gmTgKlP2WaZ+QvwlODfv0VNJp9b09E+i74a1hYiFcogmEPRBzReHWaG5 Ei/vq52drmFFyA1FAJWtD2DMBZaDCeSGoju+Sh46AOvoCB893pqg6kcpjcpL0m7UD4w6 XLbcPw+9gKDu/bwyYEmvRJnOtKfUXZn6Q8C0QoPorJOznqOu2bJcH/3JWIwn90K1iKg7 Qj3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jY1uTZvL3SDwUlJr38aN0Zxhm4r7MCsYMA7iNoJumnw=; b=bKm4XS4RjpZDoVoLM5zDVUzV6D3RoNKAQTdYHTV1bWjrAFGxnkDqrZ5p3oswu8fM2N 2Wy3fz8IZIKJznz23qFIm5w4LODQTtaxr+cxwEL6ZaweWQNKIfNEZOAkVQehi9xG5OAM SqsTnDX6a8suLRxi6iApsgySX7HMShbtPgkHLr9lRrWsu9cbJ/2iJiAp4KNj6Fi6DMjW VLKjSMZRG15TVVwAQmdWXsGb9s/qeLBSbtq9fUkwwM4u6Hdy01jd8PbeyWEkHo5SNSSb oocGRaFKmK6BLVPOLCf5u0a4oGs21NKRnhF9zoqW0rY8Lg3wN6FEu7zl40Yqagh+SZf4 Givg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz15si5538102ejb.406.2020.07.17.11.03.18; Fri, 17 Jul 2020 11:03:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728149AbgGQSDS (ORCPT + 7 others); Fri, 17 Jul 2020 14:03:18 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2502 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726322AbgGQSDR (ORCPT ); Fri, 17 Jul 2020 14:03:17 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 8236EA905E323B03CF6B; Fri, 17 Jul 2020 19:03:16 +0100 (IST) Received: from lhrphicprd00229.huawei.com (10.123.41.22) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Fri, 17 Jul 2020 19:03:16 +0100 From: Jonathan Cameron To: , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , Ingo Molnar , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua , Jonathan Cameron Subject: [PATCH v2 5/6] ACPI: Remove side effect of partly creating a node in acpi_get_node Date: Sat, 18 Jul 2020 01:59:58 +0800 Message-ID: <20200717175959.899775-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.123.41.22] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org acpi_get_node calls acpi_get_pxm to evaluate the _PXM AML method for entries found in DSDT/SSDT. ACPI 6.3 sec 6.2.14 states "_PXM evaluates to an integer that identifies a device as belonging to a Proximity Domain defined in the System Resource Affinity Table (SRAT)." Hence a _PXM method should not result in creation of a new NUMA node. Before this patch, _PXM could result in partial instantiation of NUMA node, missing elements such as zone lists. A call to devm_kzalloc for example results in a null pointer dereference. This patch therefore replaces the acpi_map_pxm_to_node with a call to pxm_to_node. Signed-off-by: Jonathan Cameron --- drivers/acpi/numa/srat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.1 Reviewed-by: Barry Song diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 8ef44ee0d76b..697a5c9e2eb5 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -444,6 +444,6 @@ int acpi_get_node(acpi_handle handle) pxm = acpi_get_pxm(handle); - return acpi_map_pxm_to_node(pxm); + return pxm_to_node(pxm); } EXPORT_SYMBOL(acpi_get_node);