From cbae610ca9e275fa982b724aa6fa50d73d38d1ea Mon Sep 17 00:00:00 2001 From: Varun Prakash Date: Wed, 9 Aug 2023 15:56:45 +0530 Subject: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() commit 1f0bbf28940cf5edad90ab57b62aa8197bf5e836 upstream. iov_len is the valid data length, so pass iov_len instead of sg->length to bvec_set_page(). Fixes: 5bfaba275ae6 ("nvmet-tcp: don't map pages which can't come from HIGHMEM") Signed-off-by: Rakshana Sridhar Signed-off-by: Varun Prakash Reviewed-by: Sagi Grimberg Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/target/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 7a6fc0ec03b1..8f7984c53f3f 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -341,7 +341,7 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) } iov->bv_page = sg_page(sg); - iov->bv_len = sg->length; + iov->bv_len = iov_len; iov->bv_offset = sg->offset + sg_offset; length -= iov_len;