From: Daniel Wagner Date: Wed, 27 Jan 2021 10:30:33 +0000 (+0100) Subject: nvme-multipath: Early exit if no path is available X-Git-Tag: v5.15.73~12676^2~3^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1bcf006a9d3d63c1bcb65a993cb13756954cd9c;p=platform%2Fkernel%2Flinux-rpi.git nvme-multipath: Early exit if no path is available 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 Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig --- 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;