Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp803763pxb; Tue, 3 Nov 2020 13:00:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjdL4c0JSDyCq5vQ6y/lqyqiT10Odz7ZseTsqrfO3IRJrYU0vRxeAzQf/xwTB6rRk69Jx7 X-Received: by 2002:a17:906:74c5:: with SMTP id z5mr21359193ejl.227.1604437239604; Tue, 03 Nov 2020 13:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437239; cv=none; d=google.com; s=arc-20160816; b=YO745pmpSJALqvTMC9ALxdapj+SEY0LW3aLnx8PyknykBFhCeAG8lLQQXMJSrRonBN nzKLRtei6Lm8Jj3r3G2HkqgbRieJ3uDagtHsheGN0Pt2fzfFQeebFzJ2B4xAEWi7/RDk ojWk/Ox4kMa5fNX6OZOhOE18xKGccCvu4ZnNRWMCUQ1NqHxHd7WhngzVQ6yM4aCXb6Gy 6i67EnxnmkZ6Nwji6fLfERyz9FQR5A3PA9dDQtOW6jNoKAINZUk/SxfNIMF7RiAN/GOf 2PccqoXMNg+76K1EkKsb4bY0obbOOXOjf2Do8j31nmTP+7takg4DBYp6XbqnQx62BBQc pe0g== 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=RUVHqfY6z6bD2dT20UioGWZkJwDbdE0mTd7KXH2AxXA=; b=wJ9ImMoR1qWxOARL/IrFPJ5aFOYxc1ogo1MvmhPsxzTkwAwUWGhasKHTAd12MoIOG9 qOkHMQT+s0wTS+ZbldXV1L5QAGVnyROxuKZzsCWT7VAWW6xhIeBF5dTGanIlsUT5bVj7 i/ejk92JB4vi23VraSJteuMiTmU33gAH2Oazn62cGqDpZRlcN7Xl6qCKItrgR7Ge3lfF QG39Yo0FCDRsZCXJBhKS+Qgl2ZwDLldMQBeFxGY7jWWgth/4uun3rrn3Ej1nOfcOlVDJ Dn4rpK+dr+W/gkuCYT9YDZeWkWXUbJZcz+eufkqfuWTzssUS125KOG2kez+qAhxWfSDj ovsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tpE80jnj; 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 ga34si6375ejc.296.2020.11.03.13.00.16; Tue, 03 Nov 2020 13:00:39 -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=tpE80jnj; 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 S1732315AbgKCUz3 (ORCPT + 99 others); Tue, 3 Nov 2020 15:55:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:55492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731206AbgKCUzP (ORCPT ); Tue, 3 Nov 2020 15:55:15 -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 C3F4322226; Tue, 3 Nov 2020 20:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436915; bh=2krI4vKDGlGHCjoREsfWY8/0uJTjTAT40akVRkQ4d1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tpE80jnjsE6x5dJ6bF7M6N7Ke4xICLvxXUg4+hIvmQmlZE2+/Bvqd9SkWxs8SvoZ7 fVMod09f3qvCp1o9cEgUo+9dH1srshHQtb6i3pzCS2gF7uJX8s061DoyMmLMnDSRUP xy5eoiThlL4HhiAtM7Xulxr/Pf0Twc6VNIjzIr/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Barry Song , Hanjun Guo , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.4 065/214] ACPI: Add out of bounds and numa_off protections to pxm_to_node() Date: Tue, 3 Nov 2020 21:35:13 +0100 Message-Id: <20201103203256.474462114@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@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: Jonathan Cameron [ Upstream commit 8a3decac087aa897df5af04358c2089e52e70ac4 ] The function should check the validity of the pxm value before using it to index the pxm_to_node_map[] array. Whilst hardening this code may be good in general, the main intent here is to enable following patches that use this function to replace acpi_map_pxm_to_node() for non SRAT usecases which should return NO_NUMA_NODE for PXM entries not matching with those in SRAT. Signed-off-by: Jonathan Cameron Reviewed-by: Barry Song Reviewed-by: Hanjun Guo Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index eadbf90e65d14..85e01752fbe47 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -31,7 +31,7 @@ int acpi_numa __initdata; int pxm_to_node(int pxm) { - if (pxm < 0) + if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off) return NUMA_NO_NODE; return pxm_to_node_map[pxm]; } -- 2.27.0