From nobody Mon Apr 6 00:30:37 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B699EC6FA82 for ; Tue, 13 Sep 2022 14:55:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234661AbiIMOxj (ORCPT ); Tue, 13 Sep 2022 10:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234694AbiIMOt2 (ORCPT ); Tue, 13 Sep 2022 10:49:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884F771BF8; Tue, 13 Sep 2022 07:26:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 006ECB80FA0; Tue, 13 Sep 2022 14:24:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C3EFC433C1; Tue, 13 Sep 2022 14:24:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079053; bh=CN5DYKDJEa1O2QN/lobli9k8aJdPFx7hCeEN8JpVquE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMpnjiNGQ90YzU3/2w/ueYhf3iGOkn3n/uVbiAj0lhJQXWQXAruafx8wphYD/tygV 4XbnKH6fMuNhO1L2U6iutsGbLKTUfGDzh6S74/qSftCpwgjLDgiFOzcVM7RX0V7NTO NZo9MLZCRRpqNCFOhZmEqavhe43YOX8E2uUVXl9o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wagner , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.10 65/79] nvme-tcp: fix UAF when detecting digest errors Date: Tue, 13 Sep 2022 16:05:10 +0200 Message-Id: <20220913140353.336580323@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140350.291927556@linuxfoundation.org> References: <20220913140350.291927556@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sagi Grimberg [ Upstream commit 160f3549a907a50e51a8518678ba2dcf2541abea ] We should also bail from the io_work loop when we set rd_enabled to true, so we don't attempt to read data from the socket when the TCP stream is already out-of-sync or corrupted. Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver") Reported-by: Daniel Wagner Signed-off-by: Sagi Grimberg Reviewed-by: Daniel Wagner Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index fe8c27bbc3f20..329aeb5fe9514 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1196,7 +1196,7 @@ static void nvme_tcp_io_work(struct work_struct *w) else if (unlikely(result < 0)) return; =20 - if (!pending) + if (!pending || !queue->rd_enabled) return; =20 } while (!time_after(jiffies, deadline)); /* quota is exhausted */ --=20 2.35.1