public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme-tcp: Fix UAF when detecting digest errors
@ 2022-09-05 10:54 Sagi Grimberg
  2022-09-05 12:04 ` Daniel Wagner
  2022-09-06  4:43 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Sagi Grimberg @ 2022-09-05 10:54 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig
  Cc: Keith Busch, Chaitanya Kulkarni, Daniel Wagner

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 <dwagner@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 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 044da18c06f5..54b4e8a7fe42 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1229,7 +1229,7 @@ static void nvme_tcp_io_work(struct work_struct *w)
 		else if (unlikely(result < 0))
 			return;
 
-		if (!pending)
+		if (!pending || !queue->rd_enabled)
 			return;
 
 	} while (!time_after(jiffies, deadline)); /* quota is exhausted */
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-19  7:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-05 10:54 [PATCH] nvme-tcp: Fix UAF when detecting digest errors Sagi Grimberg
2022-09-05 12:04 ` Daniel Wagner
2022-09-19  7:33   ` Daniel Wagner
2022-09-06  4:43 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox