From: Varun Prakash Date: Wed, 9 Aug 2023 10:26:45 +0000 (+0530) Subject: nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() X-Git-Tag: v6.1.55~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64561352c0f2140ff1ee9b4f5d920bc1fce6b56e;p=thirdparty%2Fkernel%2Fstable.git nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() [ Upstream commit 1f0bbf28940cf5edad90ab57b62aa8197bf5e836 ] 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: Sasha Levin --- diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index c5759eb503d00..5e29da94f72d6 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -321,7 +321,7 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) while (length) { u32 iov_len = min_t(u32, length, sg->length - sg_offset); - bvec_set_page(iov, sg_page(sg), sg->length, + bvec_set_page(iov, sg_page(sg), iov_len, sg->offset + sg_offset); length -= iov_len;