summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <dwagner@suse.de>2021-01-27 11:30:33 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-03 23:26:01 +0100
commite4405451dd6ef8184f6825c6903be72e30b79e4f (patch)
tree0cbf1b61c6cccf82bf9f086fd2ae9807ad9b78ce
parent64a4ec1850f779a233ad7d19dc11e340df0d7a37 (diff)
nvme-multipath: Early exit if no path is available
[ Upstream commit d1bcf006a9d3d63c1bcb65a993cb13756954cd9c ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/nvme/host/multipath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 3968f89f7855..0ac0bd4c65c4 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -233,7 +233,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;