Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp724659pxb; Tue, 2 Feb 2021 16:47:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXo0muSG4/hs/AA9ejG7F6X8qOirFW2qlolB14F/PYvqU/fWk962WaHG25w1yGq5A/FBns X-Received: by 2002:a17:907:a059:: with SMTP id gz25mr620894ejc.400.1612313234153; Tue, 02 Feb 2021 16:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612313234; cv=none; d=google.com; s=arc-20160816; b=t8bt/H4CFw5p1wSHO9T07A+OG9L3V+iH2q5wS0bHR3QssXYhHlLMjl9g0X/ZjJsopk +RtwagaF6wU1UJijmbuFfA5FF0NEVnOJT+0AXBCrz+uxla1HwSu8MFqQpR64/ZnvINqu casCnZ8RzlaCkE6SKvzcCJwosIMmTzGC9PP09grdsXjZY6cq1tBjZScKWHClkNi2J0Pl cuTkvAt2kh4wISLHgFqhIX9dgcrZVXnb3pimXL88ApSaX3JBqAoRL/SdFuJOPpAVvQLX 6AAiVgQ5D0Wc8vPBvjg+/VLZCtckaVvQlKRFQI8dLv6S33feV3i3zPNAlH2yPDg4+EqF bz2A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i8RpOlj4gAPKpULSBt91ne4K4C+NEKo+SpdzmmhOiKc=; b=hcCxlILCgZjEMKLVyNZcre7qFG9mm2IOxUnvldSbuuk9ArXwBkGIOt0QAGHjEsq9WX QH76afbgFgeGvqLq8R+Fd5fSVVg/+Pl1t3TW7HzPQ+eOZhW7F2lOTIvI/Tn1ntCKDP+U /wmaJ09M2FZuM9xVN5ZRdR9mW060YDobLdrGVlByHFkbkEBh/gbj3g5XUMiMrvj4IKgr rBoy052iEqASwsq1GnteTkY0d8qHHBUtKzZVj1YiYtq2LudG3lamJZ+ovFM5h2wMLOPN /Dgd+oNKuknLHqUIJT2VL/qIQA3WL3ogx2bugOlz4SqFTiIhvRjyq2NthN35rfFCRJLv 30iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f2/z021I"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k23si262726ejq.693.2021.02.02.16.46.49; Tue, 02 Feb 2021 16:47:14 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f2/z021I"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239914AbhBBThV (ORCPT + 99 others); Tue, 2 Feb 2021 14:37:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:45176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233187AbhBBN4S (ORCPT ); Tue, 2 Feb 2021 08:56:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 38BAA64F61; Tue, 2 Feb 2021 13:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273501; bh=RBLoRNYKmCuVRi4nEg7h1pxqF3vcqxiTgYXtW3BA87I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2/z021IRV7VU/UmjFAp0Ypd/Te/Y5BaDUs+PbNl9i1jrtUWhs5LaufFVgN2owA3G L0CTax614D8b9/hO5RQUhW1EOkt505EA6IcZ1+en77P8u0b+6HqbM8QrKz52TT7Y+w jliqjtcqrc6yBGSW2N6GNDumDVZw5h6qXETxRl5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wagner , Hannes Reinecke , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.10 130/142] nvme-multipath: Early exit if no path is available Date: Tue, 2 Feb 2021 14:38:13 +0100 Message-Id: <20210202133003.057805779@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Wagner [ 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 Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- 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 74896be40c176..292e535a385d4 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.27.0