Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1224274pxb; Fri, 22 Jan 2021 09:57:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz++JH9QQmPFSUVvhTPiew8v1r0N7nyF08xgbekGlvntqOlHZihAD0HpmzPFVvh4VJMZb/K X-Received: by 2002:a17:906:c40e:: with SMTP id u14mr3694399ejz.547.1611338261687; Fri, 22 Jan 2021 09:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611338261; cv=none; d=google.com; s=arc-20160816; b=uvknaT5bq0Bf2WwYv+YOQRe16ItQb/eeE3ogyNuZjqt+b4UIng68GVe2yJsewX9Vj4 8z6ZNXbcw+FSTnblxPL1hR/JF/Y//WsAA7TjYRoSnSE0/m02UYHB2y++TUESsvgSmO/d n/V1opmd5haTs9xeoqpstYVkiXq11iFHqLFlwp2nTp+vpMx6FeYsEIAA3aQYXqZzbtQM Y57k/WhlNoaf37X4X1PQrdycN4DhQ6AMNmSdgVWCAkYsFurDgzd52ofL9eZ+P/Jb07XN 7A4TToQ45ufKed738B8OeoMyawoKXGzb0CnKid6xh7hl1GlkewWcOY4Z45Mkm0ObDGO6 j1fw== 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 :message-id:date:subject:cc:to:from; bh=a4lY+SeUPabKuN4hkxortw/S51504TJA4uN6Sf9uSKs=; b=sfi+CZTfj5IMVwWeAziOrrnL0cBNeiyStVeiy/HBIg+WPj4UuCqs9Lw81ZdGnl1Trv 4nzYKUhzHERMhAucZwEl6sbWu0tqg6fTQlOnpEJXuWZXcpHNfr7VYsZJSgEPoByBy3j0 9kUKWjxDOSQEvAXt0wW0lMNZhwiRt7tWGA/XWRnmxu0cqQbf/8cA0Q2bhvvvil9/YP8y YyBfdZI1PqmyzNBfoFvmdzctZZRkcYjMSnZWuTYzbeIyFFE19l2KoJbT5GWOLBpuT0iV bFIiT8jmKixpQvvt/uod75i0r8GQ6Se10JU60pOqGWLpZFfAkYvSvG+sVRAX4XV19sVZ vBnQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si3941412edc.421.2021.01.22.09.57.18; Fri, 22 Jan 2021 09:57:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729820AbhAVRyF (ORCPT + 99 others); Fri, 22 Jan 2021 12:54:05 -0500 Received: from mx2.suse.de ([195.135.220.15]:51072 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729266AbhAVRm0 (ORCPT ); Fri, 22 Jan 2021 12:42:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3E20AAF78; Fri, 22 Jan 2021 17:41:33 +0000 (UTC) From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Daniel Wagner Subject: [PATCH] nvme-multipath: Early exit if no path is available Date: Fri, 22 Jan 2021 18:41:25 +0100 Message-Id: <20210122174125.145734-1-dwagner@suse.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nvme_round_robin_path() should test if the return ns pointer is valid. nvme_next_ns() will return a NULL pointer if there is no path left. Signed-off-by: Daniel Wagner --- drivers/nvme/host/multipath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index d578de0ce3aa..8837e9da1ccf 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -239,6 +239,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, for (ns = nvme_next_ns(head, old); ns != old; ns = nvme_next_ns(head, ns)) { + if (!ns) + break; if (nvme_path_is_disabled(ns)) continue; -- 2.29.2