Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp533126pxb; Wed, 27 Jan 2021 14:08:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJywPqJPdPamUKAc5qg4vqfxJlIIhK8+XNJMxAYErTfv+sT4QN81+AlEVQ1Aiya1jbujsPck X-Received: by 2002:a05:6402:1751:: with SMTP id v17mr11226055edx.289.1611785316643; Wed, 27 Jan 2021 14:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611785316; cv=none; d=google.com; s=arc-20160816; b=TyYgl2pvxlsDlER59Nz/VMWoBVIx/SQ7aJXgSUMgzPo6zGUhmUApTUExj60zzD8UzY rRy5HJiyySlaHHuclGkTVI/bvjqCrqGcysEY3MnaVctiuAAEHPzwU/HaDq8EjngvPg73 aVA0CWX4/PvM2cpSdc2BGwmYJYDMu+o+Y82Q4+ziOmpmw4SVDl/74sys+zS3Ckf9BkP/ LhLf6ODMvI1XfSIH1YbO5SVHD0a2aieOfA031eh+xYf+2M0sMS/sQITgUDT35rhdAKfb whWmqoRpYNtkaZWfmtEFvPiDYXVvC+yKxK5gPH/NF9C/dIcPukSc1sxBBjOVZge0zcU+ 12wg== 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=0YYh551P+UvC01V6MqiGzIn2RmQX2CVPk2tOcZsMa/Y=; b=z1uYD7SVUw34rPgndiL8HH7l8hkbJlACE87cFeK4aFRIXs6knVmWg2Zuz031eeySjq q5VO/Qj1Z/FuVi4JfO4DckSuyVSnuH4oxzyhztUYRwr675uyGLPfEJf20QwvdHXbfb1f 62AQJtxaVk2oOjfbqAyQxGB/penvNLJfREDo6TZ2M2WN4ul47RnIZ5AiRSUoZgkMNhMN 8QM5vZjQbpkIZ8XB5qZeRsT+FMTipnuwqVGdLBnELMsb9swzvaCBraTXx7TUbWSVA6gs 8q/rbpzQayZoisNme7aoJXgbWvaxqq/d85W43XseBwCA7Nqbxcc1EvU31lpUjnjIZkrL k2KA== 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 gw11si1333767ejb.414.2021.01.27.14.08.12; Wed, 27 Jan 2021 14:08:36 -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 S235559AbhA0Kd2 (ORCPT + 99 others); Wed, 27 Jan 2021 05:33:28 -0500 Received: from mx2.suse.de ([195.135.220.15]:58288 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235714AbhA0KbX (ORCPT ); Wed, 27 Jan 2021 05:31:23 -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 1E36EAD26; Wed, 27 Jan 2021 10:30:42 +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 , Hannes Reinecke Subject: [PATCH v2] nvme-multipath: Early exit if no path is available Date: Wed, 27 Jan 2021 11:30:33 +0100 Message-Id: <20210127103033.15318-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. Fixes: 75c10e732724 ("nvme-multipath: round-robin I/O policy") Cc: Hannes Reinecke Signed-off-by: Daniel Wagner --- v2: - moved NULL test into the if conditional statement - added Fixes tag drivers/nvme/host/multipath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 9ac762b28811..282b7a4ea9a9 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -221,7 +221,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head, } for (ns = nvme_next_ns(head, old); - ns != old; + ns && ns != old; ns = nvme_next_ns(head, ns)) { if (nvme_path_is_disabled(ns)) continue; -- 2.29.2