From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45B8F13A26F; Tue, 27 Feb 2024 14:14:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709043271; cv=none; b=Wwlu92k+Gl1rnzPjh5Y43wo+YwZW4cLNOAScgrVVKRZui9fSjg+976GmAcX4Q+2d9RXVXRJpFQEG0JtSMfaIl+AwbZl95yupymEhY1p/8MwlIV9usjfdm0L/pONCBGMYf1peWf65WxrysUCaT4M7AnKL+xigR1iEkxmQRx/vD64= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709043271; c=relaxed/simple; bh=SEXH1RtHZbUOoIgyjakkqLepgZ40jVEtVc4ox8qDmYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UFWsD4Ma76IKgJHU+LtAIdqMwEeysbcPkBPFEzCjtTjaTbWfvGBJaAfb9lQYF2BI9QqsQ6QPzHLAMurJs1/wFpA+68URiYAxlxgDG5Q/ctAdQV6clLJ0/YHihatN2JJrC4NX8kPpl7zrDFhhhm9lqqxrTohPPQmXM6BcrD7O9UY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kQicGh2e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kQicGh2e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C64E9C433C7; Tue, 27 Feb 2024 14:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709043271; bh=SEXH1RtHZbUOoIgyjakkqLepgZ40jVEtVc4ox8qDmYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQicGh2eF6H/sKGc9QZT7B4+JXZcwqUFMQIGbF1VVXPKrk3ZFSG0YHlgxtpB8ppqD GasHyH6wYUDc/WvzhwOhqZ2ZkPLhJt70DVWu7QIR89EVu4kF0HL9LYJZh5A+CpUi/G zNd+93Qjyj4zH4e5QiqwLBOCYVKKcpPuyegaljb4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hannes Reinecke , Christoph Hellwig , Daniel Wagner , Keith Busch , Sasha Levin Subject: [PATCH 6.1 048/195] nvmet-fc: abort command when there is no binding Date: Tue, 27 Feb 2024 14:25:09 +0100 Message-ID: <20240227131611.974205734@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227131610.391465389@linuxfoundation.org> References: <20240227131610.391465389@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Wagner [ Upstream commit 3146345c2e9c2f661527054e402b0cfad80105a4 ] When the target port has not active port binding, there is no point in trying to process the command as it has to fail anyway. Instead adding checks to all commands abort the command early. Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Signed-off-by: Daniel Wagner Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/target/fc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 64c26b703860c..b4b2631eb530e 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -1101,6 +1101,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) int idx; bool needrandom = true; + if (!tgtport->pe) + return NULL; + assoc = kzalloc(sizeof(*assoc), GFP_KERNEL); if (!assoc) return NULL; @@ -2523,8 +2526,9 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, fod->req.cmd = &fod->cmdiubuf.sqe; fod->req.cqe = &fod->rspiubuf.cqe; - if (tgtport->pe) - fod->req.port = tgtport->pe->port; + if (!tgtport->pe) + goto transport_error; + fod->req.port = tgtport->pe->port; /* clear any response payload */ memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf)); -- 2.43.0