From: Sagi Grimberg Date: Mon, 5 Sep 2022 10:54:17 +0000 (+0300) Subject: nvme-tcp: fix UAF when detecting digest errors X-Git-Tag: v5.15.73~363 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=13c80a6c112467bab5e44d090767930555fc17a5;p=platform%2Fkernel%2Flinux-rpi.git nvme-tcp: fix UAF when detecting digest errors [ 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 --- diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 20138e1..2c6e031 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; - if (!pending) + if (!pending || !queue->rd_enabled) return; } while (!time_after(jiffies, deadline)); /* quota is exhausted */