Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3440978pxk; Mon, 28 Sep 2020 18:33:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlFtKaJ+nr0p8b7q9FESGl3IB0Rl8zzYK25cOQIdpmag9clp5I/YpMDJ/8D0KR6pF7EhUc X-Received: by 2002:aa7:cd06:: with SMTP id b6mr764678edw.196.1601343225444; Mon, 28 Sep 2020 18:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601343225; cv=none; d=google.com; s=arc-20160816; b=vhiaY9Ckn1DU+nFRxvVN103XzuRA2rGIAkj40Jj7YZOu0VFV4NoZupyyUx66APLJEu +CgYbD4FOGTydLTMRERpHqjL/75NnQcfFjg92pC+OXWRYX+QTFf7pRX+5cvY34kB3jRg B8j9jRy+boLuRiKFe/Mx0OfmffYrwp4Vzet7/TVzs2RNXmVeXZ9qIUuVdNG62kvkFbVH rmjjw3K6E9riR02QMS08+is9w/65J4zQApbh1lbetLP14gmLhCbd6oAqleja2spCf10i zlXCXXk0xzIoztj+sVbzOg3Disj60BaLrCkik9okMKCJgD3K9txXhtnDrIiD72vubrmw 0xdg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=e23fnB2tL7yaRuFQ2Jaz5/UwEuaEePKG+ovDtgqpbtk=; b=zYEzV1GBzow23pcPNJ1EqYAJzMnH/M2ZOs/dLSjBoMVG5NrJucYhgjLT5Ct0aCfiwo 87k353y0EyS/c3jJHixRQndW2QaXa8Djqlll5wWYPZnl1zn6uRlMHPR+otEnoIoHgPzA lcfHjAWmQ7hSA+pQhuBxwH1+2c26zuBuN26Db9zwtQwmsw98KGwlP+fjioHexGMk+rR0 TwdGub5xJ8dMoEn9Byp+lEI81k0IGNNNDuFtFHqVuTkhUO+ijdrBPSxEWs326e/BdnDH bka+EKaJDUtE/MMPyEVDfL8ff4+yJ/CCI8QAhGXfSkDpaGrQqjAolj1hA3sNkHGu71qx uBaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gO0ESZY1; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si1753272edy.604.2020.09.28.18.33.15; Mon, 28 Sep 2020 18:33:45 -0700 (PDT) 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=@kernel.org header.s=default header.b=gO0ESZY1; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727570AbgI2BbT (ORCPT + 99 others); Mon, 28 Sep 2020 21:31:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:40128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727485AbgI2BbC (ORCPT ); Mon, 28 Sep 2020 21:31:02 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2015821734; Tue, 29 Sep 2020 01:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601343061; bh=VwviBkeFQfpZQfvwJnmD7Z816gFKDnEJN6hT9796Wzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gO0ESZY15Zr0SeeyPgs5DGUMFFNzgJMpg1us61fnjoodZ/JB55kAWfMy4cni2vb7z z6LnkTt9K+2kKxWZwjeATkVO21hUV7/iJevjbT3AhRAbRKTKebjU9cMDXz1QABiI3p kNiz69kD01dqhMPzaK+HguV3l8zVpDz5XgVGzcdg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: James Smart , Himanshu Madhani , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.8 27/29] nvme-fc: fail new connections to a deleted host or remote port Date: Mon, 28 Sep 2020 21:30:24 -0400 Message-Id: <20200929013027.2406344-27-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200929013027.2406344-1-sashal@kernel.org> References: <20200929013027.2406344-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 9e0e8dac985d4bd07d9e62922b9d189d3ca2fccf ] The lldd may have made calls to delete a remote port or local port and the delete is in progress when the cli then attempts to create a new controller. Currently, this proceeds without error although it can't be very successful. Fix this by validating that both the host port and remote port are present when a new controller is to be created. Signed-off-by: James Smart Reviewed-by: Himanshu Madhani Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 92c966ac34c20..43c1745ecd45b 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -3668,12 +3668,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts) spin_lock_irqsave(&nvme_fc_lock, flags); list_for_each_entry(lport, &nvme_fc_lport_list, port_list) { if (lport->localport.node_name != laddr.nn || - lport->localport.port_name != laddr.pn) + lport->localport.port_name != laddr.pn || + lport->localport.port_state != FC_OBJSTATE_ONLINE) continue; list_for_each_entry(rport, &lport->endp_list, endp_list) { if (rport->remoteport.node_name != raddr.nn || - rport->remoteport.port_name != raddr.pn) + rport->remoteport.port_name != raddr.pn || + rport->remoteport.port_state != FC_OBJSTATE_ONLINE) continue; /* if fail to get reference fall through. Will error */ -- 2.25.1