From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39861C07E9B for ; Mon, 5 Jul 2021 15:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 230B261986 for ; Mon, 5 Jul 2021 15:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232953AbhGEPeD (ORCPT ); Mon, 5 Jul 2021 11:34:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:57992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232391AbhGEPc3 (ORCPT ); Mon, 5 Jul 2021 11:32:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2599061990; Mon, 5 Jul 2021 15:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625498991; bh=CreSF3836YFQf5SepfjQHNe1Dhiejoa7yZUMT0fJ9dA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mIzp93XTqPU4papXm8Vd6kXlPZ3Z42LRA8iG7POp7aY3p8FOYpbuHjsc8bxZqxEoP xOvlbcM4OVENp3IfgWgc3e4jYF7ZVEPFvSI6ug33sZGwSZoxGK61zr1WLbB/iVUjUQ fQRZlq25ZinCq5A65INMvc23w9tC6b11AxRbI/c2KmHsI/ihaBacPfov8Bzp/Ailtq AyzI0TblEC/4VtLOiTBqsA54neYKXoMBKcTMZAO2sTtxY4SYsH1DqepVkRP68EUqSO 8QwSkKPzky6aZ8hOKpiVC/d71kN/ikfvsa5OBEGkkUMg91hvGfIC62YyY+h9SLo0rV JI/bYdqO/EH3Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hannes Reinecke , James Smart , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.12 31/52] nvmet-fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst() Date: Mon, 5 Jul 2021 11:28:52 -0400 Message-Id: <20210705152913.1521036-31-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210705152913.1521036-1-sashal@kernel.org> References: <20210705152913.1521036-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: Hannes Reinecke [ Upstream commit 2a4a910aa4f0acc428dc8d10227c42e14ed21d10 ] When parsing a request in nvmet_fc_handle_fcp_rqst() we should not check for invalid target ports; if we do the command is aborted from the fcp layer, causing the host to assume a transport error. Rather we should still forward this request to the nvmet layer, which will then correctly fail the command with an appropriate error status. Signed-off-by: Hannes Reinecke Reviewed-by: James Smart Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/target/fc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index d375745fc4ed..b81db5270018 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -2494,13 +2494,6 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, u32 xfrlen = be32_to_cpu(cmdiu->data_len); int ret; - /* - * if there is no nvmet mapping to the targetport there - * shouldn't be requests. just terminate them. - */ - if (!tgtport->pe) - goto transport_error; - /* * Fused commands are currently not supported in the linux * implementation. @@ -2528,7 +2521,8 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, fod->req.cmd = &fod->cmdiubuf.sqe; fod->req.cqe = &fod->rspiubuf.cqe; - fod->req.port = tgtport->pe->port; + if (tgtport->pe) + fod->req.port = tgtport->pe->port; /* clear any response payload */ memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf)); -- 2.30.2