From patchwork Wed May 30 19:48:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10439747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A19FE601D3 for ; Wed, 30 May 2018 19:51:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94E5929451 for ; Wed, 30 May 2018 19:51:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 920DB295C5; Wed, 30 May 2018 19:51:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58195294F2 for ; Wed, 30 May 2018 19:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932302AbeE3TuF (ORCPT ); Wed, 30 May 2018 15:50:05 -0400 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:60154 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932295AbeE3Tt6 (ORCPT ); Wed, 30 May 2018 15:49:58 -0400 Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id O75df6FW9N7esO75df2xq3; Wed, 30 May 2018 12:48:57 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.91) (envelope-from ) id 1fO75d-0008GP-Hg; Wed, 30 May 2018 12:48:57 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Long Li Subject: [Patch v2 11/15] CIFS: Pass page offset for calculating signature Date: Wed, 30 May 2018 12:48:03 -0700 Message-Id: <20180530194807.31657-12-longli@linuxonhyperv.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530194807.31657-1-longli@linuxonhyperv.com> References: <20180530194807.31657-1-longli@linuxonhyperv.com> Reply-To: longli@microsoft.com X-CMAE-Envelope: MS4wfDibnuFYbLcY2kO/XljN2SKYBCz+plOqslMOuLT2xRN13brMygYq7RgUSLiUOfRqUswktyft64Wu9NIrxZ7/em2rILIIxw9wsLyMhQvQrf/38mzbTaN+ SaGiJLcCz/1A6nY+Zjt1JyWRkV9DouxWB6mt1T9JYH7iiUM6oxMzWBrlSEvO3gw/1W/y8rp3SzUn9rIHmTqwO+SIUNbREOw6TXF+xr3erLxTV4GT8PYG56BL kN1Q0KC/PID1iFac4utKjEVFFu9HtBGSgymZ2lee8vEr0QCzp/wl2Lg8HNyNH2oh3GCfhv5qVeuT4FSBDVWIidAPIe8a0fT/ewtWvpeLHetPNSqq1BUBy2ET Q9nFVc+bFHDj2wIxun02L+T340N40Ne7F0tZs1aLr/Qx6TlQ7ZQ9uc4nUlQYX6ObWvC4oOX/ Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Long Li When calculating signature for the packet, it needs to read into the correct page offset for the data. Signed-off-by: Long Li --- fs/cifs/cifsencrypt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index a6ef088..e88303c 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -68,11 +68,12 @@ int __cifs_calc_signature(struct smb_rqst *rqst, /* now hash over the rq_pages array */ for (i = 0; i < rqst->rq_npages; i++) { - void *kaddr = kmap(rqst->rq_pages[i]); - size_t len = rqst->rq_pagesz; + void *kaddr; + unsigned int len, offset; - if (i == rqst->rq_npages - 1) - len = rqst->rq_tailsz; + rqst_page_get_length(rqst, i, &len, &offset); + + kaddr = (char *) kmap(rqst->rq_pages[i]) + offset; crypto_shash_update(shash, kaddr, len);