From 79f2fc4faa0d2b3fb8d87ce7f6c7a1ca10507023 Mon Sep 17 00:00:00 2001 From: Dan Aloni Date: Mon, 16 Nov 2020 14:58:16 +0800 Subject: [PATCH] svcrdma: fix bounce buffers for unaligned offsets and multiple pages stable inclusion from linux-4.19.154 commit 95e7b4ee3d35c8d2bca4ad3c3365abdea0bbb71d -------------------------------- [ 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 Signed-off-by: J. Bruce Fields Signed-off-by: Sasha Levin Signed-off-by: Yang Yingliang Signed-off-by: Aichun Li Reviewed-by: wangxiaopeng Signed-off-by: Yang Yingliang --- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index aa4d19a780d7..4062cd624b26 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -639,10 +639,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++; } } -- GitLab