]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
svcrdma: fix bounce buffers for unaligned offsets and multiple pages
authorDan Aloni <dan@kernelim.com>
Fri, 2 Oct 2020 19:33:43 +0000 (22:33 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:08:07 +0000 (10:08 +0100)
[ Upstream commit c327a310ec4d6ecbea13185ed56c11def441d9ab ]

This was discovered using O_DIRECT at the client side, with small
unaligned file offsets or IOs that span multiple file pages.

Fixes: e248aa7be86 ("svcrdma: Remove max_sge check at connect time")
Signed-off-by: Dan Aloni <dan@kernelim.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/xprtrdma/svc_rdma_sendto.c

index 38e7c3c8c4a9caf80daf2b71e2a6223763c05f40..e4f410084c748e597778f26512dad752e838020a 100644 (file)
@@ -637,10 +637,11 @@ static int svc_rdma_pull_up_reply_msg(struct svcxprt_rdma *rdma,
                while (remaining) {
                        len = min_t(u32, PAGE_SIZE - pageoff, remaining);
 
-                       memcpy(dst, page_address(*ppages), len);
+                       memcpy(dst, page_address(*ppages) + pageoff, len);
                        remaining -= len;
                        dst += len;
                        pageoff = 0;
+                       ppages++;
                }
        }