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: 3f2304f8c6 ("nvme-tcp: add NVMe over TCP host driver")
Reported-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Sagi Grimberg 2022-09-05 13:54:17 +03:00 committed by Greg Kroah-Hartman
parent a4f0d34580
commit 19816a0214

View File

@ -1074,7 +1074,7 @@ static void nvme_tcp_io_work(struct work_struct *w)
if (result > 0) if (result > 0)
pending = true; pending = true;
if (!pending) if (!pending || !queue->rd_enabled)
return; return;
} while (!time_after(jiffies, deadline)); /* quota is exhausted */ } while (!time_after(jiffies, deadline)); /* quota is exhausted */