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 322C513B7AB; Tue, 27 Feb 2024 14:27:00 +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=1709044020; cv=none; b=ESNe9OnaFRt8XrPJVWu34KkrLuZlabKkTr2RLXFVci/zlIRoEkLQfcL05zNuH3hChMlhkbGlfv6r4U1DNtkIUI6BkYVyJaWlOQ9fJz7xIGo3QYrMETiP6e1onAu4ASU++dHcLicA05Jxlpfh8J1U5LUUoS7uHR3sYK5ANCCpVec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709044020; c=relaxed/simple; bh=WePfwxa5H3AhCqOjcp7bkvVBQcIDWYMAVk1sxho/dwY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VTSMoaSmf5fEoZEVvysq1QHGkhxplo1g3zbkEyc/76+Uhq+oQickbzGTxYdW00bBlps1jbxgeCRjcKdPWAcov0fIv9dkwwLOG+/3vAIDAPg9+VmU84qPPP9Apgo/OEoeDsmgfK0vXmm00RDV7GnYKgu252cTKSPjcvBcF+D6g1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ENJxC8vv; 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="ENJxC8vv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B57F1C433C7; Tue, 27 Feb 2024 14:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709044020; bh=WePfwxa5H3AhCqOjcp7bkvVBQcIDWYMAVk1sxho/dwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENJxC8vvqrAPlfgSuX+fz+7qzWljqZwgdlaYtxf0jX9+qXsCxk4tdGpYQSOyxk6Qy +hJQIhFV9fOG5YnMElCr6RXzkexhIFFMEjQR3bYxlYheluCW7m5cE9aVuMx9L2UEyo l593g2/RfZeEoVnu1SCeH3SfPSb/V+eDHQ48ii/w= 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 5.10 033/122] nvmet-fc: abort command when there is no binding Date: Tue, 27 Feb 2024 14:26:34 +0100 Message-ID: <20240227131559.789952492@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227131558.694096204@linuxfoundation.org> References: <20240227131558.694096204@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-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 18a64a4fd8da9..846fb41da6430 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -1102,6 +1102,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; @@ -2529,8 +2532,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