Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4828640imm; Wed, 30 May 2018 12:51:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLn80kPN4ELEfKCNfCXXCAnLqvfdl9gD4ehGu3BDCNsKagvlTjMWEmCgVYuNtkwHMlSSLPZ X-Received: by 2002:a63:6b84:: with SMTP id g126-v6mr3152338pgc.272.1527709912875; Wed, 30 May 2018 12:51:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527709912; cv=none; d=google.com; s=arc-20160816; b=SPFmc8YfJVi/d+rAwPRKQXNwF7rDWHsIn36w3/+D2YCsNnG+LUmMyjEVtvSdaPqrgK /aTrEXmQtXwNaHtiNOq9vxUkhR3RDSkOGumD99k5xoBY4Y0790dgISMRF+cRtL5dEOPr S79bvdJTPKugIDgIW0T8hquJXqSVH9hSSRC3RFfk2mZF30ooI7Nfi/oPdBLFuWMuxCdU 1ZRdn1POHCCFYjeI/qmTf0eXjhgSMmnx/Rl/amU1553QCivvD9k9zAjYAI1AaPKjbv0v SNrpb5eavTZKPdU6XcojsbzyGaZjVGB3c9qcehIf5noeMP+i4MFWXQuX7PAj10Mirx38 xnrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=iBvUDA0prOTwwLgvllBZt+BLQ9yfZtRVPIBuFxw2JpI=; b=B0bqGdE+RvsDEa/JlWDxu7jqjGWFSgUCUuyPEwWi0L3+PssQ7HF8HTylgWNQ070fdV /5qKSMGX2AeuQaZeVC4pNcIyUqEI+ADY0AotCjLJBNxuUhp3nhIZY72dAD7GezF++Tlm M8J4rImy21s4EGvKHRxTm62tFUzISt7n5fL/K1BesmD1VNNMgh4yCYqRTo3JgHKrvK3/ WY/aHVovkcukHBqE53SB9MibSg/Fcqa7wAmwRqBuI5HnJt4ZQrgpA0MRW1lPMKDIz2du t33z4QIDceV4nEuRmEP/0A6vwfrRoagyILfvo3A+LV5no8RpkicDt49ozzDcN7AlqvXK Up7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si9618791pgb.430.2018.05.30.12.51.39; Wed, 30 May 2018 12:51:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932323AbeE3TuG (ORCPT + 99 others); Wed, 30 May 2018 15:50:06 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.7.4