From patchwork Sat Sep 8 02:13:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10592833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97E84921 for ; Sat, 8 Sep 2018 02:16:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 914262B684 for ; Sat, 8 Sep 2018 02:16:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 859252B68A; Sat, 8 Sep 2018 02:16:13 +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 484B22B684 for ; Sat, 8 Sep 2018 02:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727008AbeIHG7Z (ORCPT ); Sat, 8 Sep 2018 02:59:25 -0400 Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:47276 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726924AbeIHG7Y (ORCPT ); Sat, 8 Sep 2018 02:59:24 -0400 Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with ESMTP id ySlifRM6RWFPMySliffd0t; Fri, 07 Sep 2018 19:14:38 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.91) (envelope-from ) id 1fySli-0005Ea-1C; Fri, 07 Sep 2018 19:14:38 -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 v3 12/16] CIFS: Pass page offset for calculating signature Date: Sat, 8 Sep 2018 02:13:44 +0000 Message-Id: <20180908021348.19956-13-longli@linuxonhyperv.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180908021348.19956-1-longli@linuxonhyperv.com> References: <20180908021348.19956-1-longli@linuxonhyperv.com> Reply-To: longli@microsoft.com X-CMAE-Envelope: MS4wfEf7XrAtleugwZSn2k4AGIUVnAcrhhMEe3q6Pl73FaxK94SIT5r86E38o9hVY9BFMS5gFz6Ib7HIOkwI6iTNXv+lz0xy51G73pOefQzRXXjwnWPq7jQr Xoyw+RJArPfjwq37a72Il4+FINqNmi9/SeBh91+Im9eayaFfmNLqxbsAruz7t9/iRGsCDYZaAr8RnXqMJRF6XLCEsl3PhGMrQtNPlKQZC7ZoRWTVp5ouqs38 ysHwAAl/PnGUc0d0RnKb5Sj/I69SJoHm00SXlzMt4cvc65/arR2qREUNhgS73tOMFUYutV5rHCOlyYAviRtT6YYRbqowBH/kGccQ3zrvkmdJHeTt6uNUGwRI F9ARafu4kZvb1+GbaYLJF9PWTos0pnOIeFIge5rzXlhAezTz4edj59o1YQH24uR2YuKGyuLp Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@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);