From patchwork Tue Oct 27 13:53:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 312173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD422C55178 for ; Tue, 27 Oct 2020 17:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 934DB218AC for ; Tue, 27 Oct 2020 17:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603818027; bh=V848PUZLDPprJD8EhClYcg6o7BI+rxXHp2BCdI6ULUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2bNIsEAXC/h5UEY05G4rQ1ommm0tZFawBSq43Gje/jXhLY85soM8HND5ZfhWd2fcJ BF1YVdCe4LKUXZGjCvadACUJydOV/jlV2XKo71DzdSDrXMtbj1SFFP9LUhR73D+hah rYOLPuZIbsshNJ01kppHNWWs5A15O9t6tVjQXYBs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1814902AbgJ0RA0 (ORCPT ); Tue, 27 Oct 2020 13:00:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:44196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793881AbgJ0PIv (ORCPT ); Tue, 27 Oct 2020 11:08:51 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A3682072E; Tue, 27 Oct 2020 15:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811330; bh=V848PUZLDPprJD8EhClYcg6o7BI+rxXHp2BCdI6ULUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTKywKu5U1fLbyB2v8UdLWoGAI7/Z1BmKBD6WfzzWc50edti0KDk2nEoyLdr0F5j9 cTts1/NYP0tGv2qhQGyhtG6dl+1/DVDP8ohD0OuRqoVd5Dr6UUbn9n7+OJJ/sttNGh KrnxVt9IB/kFROS48BRH4r9VvKRgKIOzOGnkLWNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Aloni , "J. Bruce Fields" , Sasha Levin Subject: [PATCH 5.8 456/633] svcrdma: fix bounce buffers for unaligned offsets and multiple pages Date: Tue, 27 Oct 2020 14:53:19 +0100 Message-Id: <20201027135544.106853688@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Aloni [ 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 --- 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 38e7c3c8c4a9c..e4f410084c748 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -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++; } }