From nobody Sun Sep 14 22:49:45 2025 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 17334C54EE9 for ; Tue, 13 Sep 2022 14:36:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234267AbiIMOgZ (ORCPT ); Tue, 13 Sep 2022 10:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234146AbiIMOfL (ORCPT ); Tue, 13 Sep 2022 10:35:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78CB65647; Tue, 13 Sep 2022 07:20:13 -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 23D53B80FA1; Tue, 13 Sep 2022 14:20:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8395AC433D6; Tue, 13 Sep 2022 14:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078811; bh=CO0cxQ9bEfGQgN86ADpT9qFlY9TonYmIv8XWfQ493+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pR8ujW7OwMrubNQcXkAHWq4ehGaQUQknDOdzaHkYStOo3gkoWgmAVAWi2smhj+M96 i+r8rRIRLfJ08VEglMyPZCGzPePwYMIEJpNYS6oBUJd2qTEV/InxD9J5jhfF+rpTmt MPL5jFtxJfN7StApXQjaBX23sgH32wMWQaNanFgY= 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.15 091/121] nvme-tcp: fix UAF when detecting digest errors Date: Tue, 13 Sep 2022 16:04:42 +0200 Message-Id: <20220913140401.273406682@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140357.323297659@linuxfoundation.org> References: <20220913140357.323297659@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 20138e132558c..2c6e031135716 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -1209,7 +1209,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