Skip to content

Commit

Permalink
nvme-tcp: fix UAF when detecting digest errors
Browse files Browse the repository at this point in the history
[ Upstream commit 160f354 ]

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: 3f2304f ("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>
  • Loading branch information
sagigrimberg authored and gregkh committed Sep 15, 2022
1 parent 94c34fa commit c3eb461
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/host/tcp.c
Expand Up @@ -1227,7 +1227,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 */
Expand Down

0 comments on commit c3eb461

Please sign in to comment.