From: Daniel Wagner <dwagner@suse.de>
Date: Wed, 27 Jan 2021 11:30:33 +0100
Subject: nvme-multipath: Early exit if no path is available
Patch-mainline: v5.11-rc6
Git-commit: d1bcf006a9d3d63c1bcb65a993cb13756954cd9c
References: git-fixes
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")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/host/multipath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -239,7 +239,7 @@ static struct nvme_ns *nvme_round_robin_
}
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;