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 710D6392C50 for ; Sun, 19 Jul 2026 12:14:05 +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=1784463247; cv=none; b=sDnm6wTC/poNtqckW0D/JuZAHDCvGfGpzwDVHjH6G3un7bRxrTfYpWeEY6Mv6rI1ItD9ewmP20u7q9QF5IVoS9vWSKiKHyTVUJyGaDzSR2nvYSg/ojebXvUFDeyLS7OvAyjmWodPwNSfyF4Et5HmJpa6/iWeqORxRnIaU/xgDNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784463247; c=relaxed/simple; bh=QpAjSVCe3DnSkr2YgMGJudtWunjo+79TaO1umSPWAZc=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=T9wIE/pJXzmbs7zfwV+1kDqu7P9+x+9dQpDUZJIG5P4QnpG0728MBVExvb+4jQBxvC232dke0kUoxLwPyDbXOmfuhK5h87kG3dKngEE49OfG4njV9c8ek+cv7mqx5dzCtENmylXbEtArXSQJolpwB8rQs6WZrIzhPsLk72rRrWs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wEDlmEhm; 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="wEDlmEhm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F4ED1F000E9; Sun, 19 Jul 2026 12:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784463245; bh=2xPK3SkXxJTvvH+YI6MOv+/gxWou5i2JE1IuIoZJLgU=; h=Subject:To:Cc:From:Date; b=wEDlmEhmC1hJP1vUZ7+R478a1VCYrhMjPZvACgopzr6UYKfxEMA5HYlszw0Z9R+gi 5kZWZhWRSALCljN1qBMYBo3tGJLdTw7/GKjb0zBlS1Sr4qgBzwR00whV/xo22Q8h+x L9Dr/FiTMRkPqzu8yw/PNyMQZh/Y0kuYc91HCIac= Subject: FAILED: patch "[PATCH] nvmet-tcp: Fix potential UAF when ddgst mismatch" failed to apply to 5.15-stable tree To: sagi@grimberg.me,hch@lst.de,kbusch@kernel.org,kumar.shivam43666@gmail.com Cc: From: Date: Sun, 19 Jul 2026 14:13:57 +0200 Message-ID: <2026071956-wildcard-pacemaker-f337@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x dbbd07d0a7020b80f6a7028e561908f7b83b3d5a # git commit -s git send-email --to '' --in-reply-to '2026071956-wildcard-pacemaker-f337@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From dbbd07d0a7020b80f6a7028e561908f7b83b3d5a Mon Sep 17 00:00:00 2001 From: Sagi Grimberg Date: Sun, 10 May 2026 23:30:29 +0300 Subject: [PATCH] nvmet-tcp: Fix potential UAF when ddgst mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shivam Kumar found via vulnerability testing: When data digest is enabled on an NVMe/TCP connection and a digest mismatch occurs on a non-final H2C_DATA PDU during an R2T-based data transfer, the digest error handler in nvmet_tcp_try_recv_ddgst() calls nvmet_req_uninit() — which performs percpu_ref_put() on the submission queue — but does NOT mark the command as completed. It does not set cqe->status, does not modify rbytes_done, and does not clear any flag. When the subsequent fatal error triggers queue teardown, nvmet_tcp_uninit_data_in_cmds() iterates all commands, checks nvmet_tcp_need_data_in() for each one, and finds that the already-uninited command still appears to need data (because rbytes_done < transfer_len and cqe->status == 0). It therefore calls nvmet_req_uninit() a second time on the same command — a double percpu_ref_put against a single percpu_ref_get. Reported-by: Shivam Kumar Reviewed-by: Christoph Hellwig Signed-off-by: Sagi Grimberg Signed-off-by: Keith Busch diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 164a564ba3b4..20f150d17a96 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -1321,8 +1321,10 @@ static int nvmet_tcp_try_recv_ddgst(struct nvmet_tcp_queue *queue) queue->idx, cmd->req.cmd->common.command_id, queue->pdu.cmd.hdr.type, le32_to_cpu(cmd->recv_ddgst), le32_to_cpu(cmd->exp_ddgst)); - if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED)) + if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED)) { + cmd->req.cqe->status = NVME_SC_CMD_SEQ_ERROR; nvmet_req_uninit(&cmd->req); + } nvmet_tcp_free_cmd_buffers(cmd); ret = -EPROTO; goto out;