From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C5BE832B125; Sat, 12 Sep 2026 14:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789224075; cv=none; b=etD239qqEdZs3ArxpNeAkjXcPWEL+eVw6ED8b1WNJ2b4cvpQ4q+N8s7RftKiplVGGTmLe5b5YdnughPiuAL4hi/4UM5sO4vVLfvacLiCnljcgOPxeB0Fb1FVjujHTEi4BKtERuDK82CIrueRvpmteuEy+P6PUVZcIceFxW5UNOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789224075; c=relaxed/simple; bh=GVu736J9t/hz8dqDlQn3LtgwTALjmgvjp3D12gznXYY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J9igoaNWboRsMGuY1KjgFOlS92zBpUm49xM8TtiLNYqUU/9sUv3Q+h0xMJVRqUP9++sK1BKlPW6siKEYbRHZBsfkPVE6+nUqL5H9PRvGba9GiwUzuBB/f4odFd2dt50U12s6X+QQ8BvlpPEmQP/oXj/JWI8w9jx7c+qwdIgeEjM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MSKVuDg/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MSKVuDg/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EA901F000FF; Sat, 12 Sep 2026 14:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789224073; bh=41lTiOo0vQvy2OZr9nNi7xnDU8nI98sv/78igVlbwuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MSKVuDg/XjcCoAgMhSFxNf3XgEo37XCjOiXpLPjE4hHycm1yMBZIBeP4PFLpBtVDk wZXzP0jujskIdochFJN3Q8ZNCN7ahZvLitIHypGr88pH38EH9MlDkVhNiQifJnnrv+ jKFkYp31zDQxK2B4zctHFOPYAzB9ChjB88G0T/Us= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , Guixin Liu , Keith Busch , Sasha Levin Subject: [PATCH 6.6 0920/1424] nvme-fc: unmap cmd_iu DMA on rsp_iu mapping failure in init_request Date: Sat, 12 Sep 2026 08:55:52 +0200 Message-ID: <20260912065627.927528410@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@linuxfoundation.org> User-Agent: quilt/0.69 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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guixin Liu [ Upstream commit f49d0c3a8d56a7cda1628ae17341a4a42063563c ] __nvme_fc_init_request() maps cmd_iu and then rsp_iu for DMA. If the rsp_iu mapping fails, the original code only recorded the error and fell through: it left the already-mapped cmd_iu unmapped and still marked the op as FCPOP_STATE_IDLE before returning. Since blk-mq does not call .exit_request() when .init_request() fails, the cmd_iu mapping is leaked for every op whose rsp_iu mapping fails. Jump to an error path on rsp_iu mapping failure that unmaps cmd_iu and returns the error without marking the op idle, so it stays in the FCPOP_STATE_UNINIT state set by the initial memset(). Fixes: e399441de911 ("nvme-fabrics: Add host support for FC transport") Reviewed-by: Christoph Hellwig Signed-off-by: Guixin Liu Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index a61734614fd3b..3d3cf79d92496 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -2092,9 +2092,15 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl, dev_err(ctrl->dev, "FCP Op failed - rspiu dma mapping failed.\n"); ret = -EFAULT; + goto out_unmap; } atomic_set(&op->state, FCPOP_STATE_IDLE); + return 0; + +out_unmap: + fc_dma_unmap_single(ctrl->lport->dev, op->fcp_req.cmddma, + sizeof(op->cmd_iu), DMA_TO_DEVICE); out_on_error: return ret; } -- 2.53.0