Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2568755yba; Mon, 6 May 2019 08:07:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6zU+VNYITUUE6SEFSuoKnnBvHsotroo86UL/PkXzOKJ1+/nuAGHZqv4nQyaM87JV/nqp0 X-Received: by 2002:a62:3892:: with SMTP id f140mr33505376pfa.128.1557155274513; Mon, 06 May 2019 08:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557155274; cv=none; d=google.com; s=arc-20160816; b=T6ZTuFTlXt4P+or4nq5suRt13Zz4xvz7o7U1/Cdr6soZ9YIRgntR+CySzietU9yDg/ 5AiEIdCaOZCRL0mipqQHzQpSvnJwgDBe5nN5tSDt4X0gyfaw7iHac4HXB321e59dxMln iNaN8uFSjwOl4iSn/qaVtqaL3aeB+ZvXevlUoosrMtwVgsGSbXsAPgAK4KDOnmG5EPJ8 MIpf6kxj7ea/7L1+U3Z2xi9GeRpbkY4gMBy7W86o2cQ7+mF1BTP+F5Dh5fIEcWLDj6vJ 2aOq3GCDKf3NaUJNb90JZ0AZD0JLiNxkUiOXN106sGhq9V+LS8HIjc+RsMt+LhjGS+WI 2OSA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T6t1uK/YdLtGJIFGWB9TmuFB3qajQfCC09DrBaVAZsw=; b=eg7pyNp3bynwCDYEkOS1s9W/cnEC1QmnhuqDSXUEITxSt3pAbOQHgpzL9KOKPxez5T 3nBzYe58Dq/8vPw4dhN63HazBJ1emKx6vgBpH2s6uSklLrsrjOFfDmxLwCQ2aZmqp/mU 5E4RM5agU+jP18kabHWFrLLiKgMTH5Lni2PmjxvZEK5HFQe0Q5gVvXA90bBmLekNolqU MeOTqqb+9kW+QCD52Ck1oMsK/uCeiQJqiYj+FLgwOeZmOz57IkjUA+VKxxIpTPTjL1Cb YTuj3achxyyFy7sB3DoY5XFcRwlmmaUiTB4tAe13w1fnphRzjyKyhKH3JKqFFDX+IkRC QEfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfFhi8ni; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15si15039607pfp.44.2019.05.06.08.07.37; Mon, 06 May 2019 08:07:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfFhi8ni; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726977AbfEFOhu (ORCPT + 99 others); Mon, 6 May 2019 10:37:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:58630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbfEFOhq (ORCPT ); Mon, 6 May 2019 10:37:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 AC446204EC; Mon, 6 May 2019 14:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153466; bh=7OxJbkyPyhXvXcm9b2wqW0qcqTSUjNm69XWQPModrrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfFhi8niW4jC0Q+yX3cg5HBf2uFgbjmx5rwIWMeNARXFB/irLNlgirrqa/DsKUj5A 2gCGHVUfrPvshuMpIAeup1QsngerCF3O5nwM3tYCtslDU69/6nXycWRStP8OGzIQlb T9d8VSnNkaF3+oikMh0rEH7kDw5N9aU30mWFiUdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Pittman , Jens Axboe , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 078/122] null_blk: prevent crash from bad home_node value Date: Mon, 6 May 2019 16:32:16 +0200 Message-Id: <20190506143101.836774644@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 7ff684a683d777c4956fce93e60accbab2bd7696 ] At module load, if the selected home_node value is greater than the available numa nodes, the system will crash in __alloc_pages_nodemask() due to a bad paging request. Prevent this user error crash by detecting the bad value, logging an error, and setting g_home_node back to the default of NUMA_NO_NODE. Signed-off-by: John Pittman Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin (Microsoft) --- drivers/block/null_blk_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index 62c9654b9ce8..fd7a9be54595 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -1749,6 +1749,11 @@ static int __init null_init(void) return -EINVAL; } + if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) { + pr_err("null_blk: invalid home_node value\n"); + g_home_node = NUMA_NO_NODE; + } + if (g_queue_mode == NULL_Q_RQ) { pr_err("null_blk: legacy IO path no longer available\n"); return -EINVAL; -- 2.20.1