From patchwork Fri Oct 26 13:57:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 10657421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECCD715A7 for ; Fri, 26 Oct 2018 14:21:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D673A2C7CE for ; Fri, 26 Oct 2018 14:21:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA74E2C7FC; Fri, 26 Oct 2018 14:21:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 73D9F2C7CE for ; Fri, 26 Oct 2018 14:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=tpbG+iZ2xCr0fs1xOg3FGG8eV6tuM64xS6FGXon3O+4=; b=BAVrs/FM/J3w4D kfVJTCCfybAVzhB2RmOJyG7Uf4Cke8vZJq2n+pwMxY7OAwP26Of0PV1/h8O6VbBRwgWYcNidUN1qU nHPbIdM3XkY40n9ekgWaOfOpmfsZpZuaCriRf5VxDRMClT0u2OsR1AFPOpEVZ0ifP7PndaNXge4Bm m1q3CifA7tM3LG17ZDsHod8wiAniyIw1EmnHmfOjnoXwokc8HdlzeaNKMrJlY6ovTUgeTmZZ/QvOf p2gxEYrWmvWhLkxv/AinPA4zJ+fkZqjuFbr2Lm9h8KpH2jQqeJ44hOmSWWERd3Rnn0QbqQn4mPvp+ omx9O8ituoujN+wfRjEg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG2z1-0004cC-W8; Fri, 26 Oct 2018 14:21:04 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG2yU-0004G1-9C for linux-arm-kernel@bombadil.infradead.org; Fri, 26 Oct 2018 14:20:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:Message-ID: Date:Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kLhPPZAvYXN84FKVMnm8rHuNDgj4OBk4I8J0rPzQ8rA=; b=H3iNMFat1YQpDQt2yCyBLgQA0u 3BDMgHNb1jD9ehUARML51Rdv1+epqNkqkgbVV4jZisjCG7dfTJF4F0eQtLWdhfJyDElF+o+30Wq/C YCMQIBx99qPChgkCu0Gt6p+/8tANqCM9keGHlZpdYP00KMJXibMIwLs2+uTj9fEsRIFamAR8PP20f dX80TTO/ZpLCp+0iue5AOPQFN3xSPD3xgoev0JT+MRKY4l9uBMkxFKDwjKeGqqdGtwnWNRHl09QLN WbY6LFKRA4uYNCNpuDjHCu7ykARu61X/b3iWRNH6H41QiH4cRHj4qWPp1LTjM30I5DuSE5ltDb3WB topF9wfA==; Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG2bU-0005rw-Fn for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 13:56:46 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 378C7C40EAC34; Fri, 26 Oct 2018 21:56:21 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.408.0; Fri, 26 Oct 2018 21:56:14 +0800 From: John Garry To: , Subject: [PATCH] arm64/numa: Add more vetting in numa_set_distance() Date: Fri, 26 Oct 2018 21:57:47 +0800 Message-ID: <1540562267-101152-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181026_145644_738673_AAAED7CF X-CRM114-Status: UNSURE ( 7.30 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Garry , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently it is acceptable to set the distance between 2 separate nodes to LOCAL_DISTANCE. Reject this as it is invalid. This change avoids a crash reported in [1]. [1] https://www.spinics.net/lists/arm-kernel/msg683304.html Signed-off-by: John Garry diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 146c04c..6092e3d 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -335,7 +335,8 @@ void __init numa_set_distance(int from, int to, int distance) } if ((u8)distance != distance || - (from == to && distance != LOCAL_DISTANCE)) { + (from == to && distance != LOCAL_DISTANCE) || + (from != to && distance == LOCAL_DISTANCE)) { pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n", from, to, distance); return;