[PATCH 5.15 75/75] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()

Greg Kroah-Hartman
2026-02-09T14:56:26Z

From: Varun Prakash <varun@chelsio.com>

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 <rakshanas@chelsio.com>
Signed-off-by: Varun Prakash <varun@chelsio.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvme/target/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -341,7 +341,7 @@ static void nvmet_tcp_build_pdu_iovec(st
}

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;