From patchwork Wed Aug 5 18:28:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victoria Milhoan X-Patchwork-Id: 6952451 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 11DD8C05AC for ; Wed, 5 Aug 2015 18:29:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42292205C2 for ; Wed, 5 Aug 2015 18:29:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A964205CB for ; Wed, 5 Aug 2015 18:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753199AbbHES3I (ORCPT ); Wed, 5 Aug 2015 14:29:08 -0400 Received: from mail-bn1bbn0103.outbound.protection.outlook.com ([157.56.111.103]:19391 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753725AbbHES3B (ORCPT ); Wed, 5 Aug 2015 14:29:01 -0400 Received: from BN3PR0301CA0015.namprd03.prod.outlook.com (10.160.180.153) by BY2PR03MB571.namprd03.prod.outlook.com (10.141.143.145) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 5 Aug 2015 18:28:52 +0000 Received: from BN1BFFO11FD026.protection.gbl (2a01:111:f400:7c10::1:162) by BN3PR0301CA0015.outlook.office365.com (2a01:111:e400:4000::25) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Wed, 5 Aug 2015 18:28:52 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; kernel.org; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD026.mail.protection.outlook.com (10.58.144.89) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Wed, 5 Aug 2015 18:28:51 +0000 Received: from stc-hedley.am.freescale.net (stc-hedley.am.freescale.net [10.67.70.12]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t75ISmAA019320; Wed, 5 Aug 2015 11:28:50 -0700 From: Victoria Milhoan To: CC: , , , , , , Subject: [PATCH v2 06/14] crypto: caam - Correct DMA unmap size in ahash_update_ctx() Date: Wed, 5 Aug 2015 11:28:40 -0700 Message-ID: <1438799328-10757-7-git-send-email-vicki.milhoan@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438799328-10757-1-git-send-email-vicki.milhoan@freescale.com> References: <1438228709-27650-1-git-send-email-vicki.milhoan@freescale.com> <1438799328-10757-1-git-send-email-vicki.milhoan@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD026; 1:hqXr4bLKDPdHpCD+2QbcQXxkyqm+yD3urrWc8QLp9Ro+GeRw2Ah4+SL4iEao0xYU93jkx3z12jYxkzNKeegzIqVYnXzcwTBkMNkbg38RldCriJ6jhPiJEDs2amRMGV+xhBxCAZ0pN+2IszZarmjYFEiaaZbSFUg+YU36qp1S9wpj4KQzYkLYXTS7o2Z8HO67/X//tn2mVSpWrueNMwG0jxaeu/+fLZ12nUl3shaIQmOh9KvtUuuhUkbpi6YeY5IIZ3zutFHdmgVgm9G40LTtCA+IEsZe47lfjn3z3aB2TwdpHXIJm8sTOnWZMjvAV2F74lM/6qOe9CyYuhmGZ6QWmg== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(62966003)(85426001)(4001540100001)(104016003)(33646002)(81156007)(77096005)(97736004)(2950100001)(106466001)(5001860100001)(5001960100002)(105606002)(36756003)(229853001)(6806004)(77156002)(92566002)(50986999)(2351001)(5001830100001)(76176999)(46102003)(87936001)(47776003)(575784001)(189998001)(110136002)(68736005)(5003940100001)(86362001)(19580395003)(48376002)(64706001)(50226001)(69596002)(50466002)(19580405001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR03MB571; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB571; 2:OnZrMU7tXG0++SbuHrHHofed8P/kPsgK44vooAzD643oxorTEVPUvArtT1JPtZkrIOw7NdcAKlli9dBsPoekN3m4Xy1JNiA6NMFIuApk6izCwNSCskh8SYGiXN7udNeJPtzjvXgNjQB0OsfXIFNhTsJ63dv+cYxfvVgFLMHmdnk=; 3:ncsRrZHniz51SAbcKvzJs4HKnlYtMiyavDeBgeXSVgkj0Szlfni03t6e3IT3Vqeqe2IUvLXPAKFwZVxUSBRnkvSJT98P1vnyYokKS+8L4tgWetGnVTV/N4+IpFzSK6duabm9iNK3SF1KbgADlKCnP0V8P65blsC6copKO+9VJcXSz//OlWoQOu3WcW8RHSnjYbFupyPgy/JWZxGc+7iNEp84FCtddEqpZ31rB+jIgeo=; 25:VDQ3at7h1kLShkK/NAIiTtmQRHlhIWUBTyBh7qPGYv+yxvNAzK+k+Je40xJfYeEMKZj2BsY93gDCC2+mt9bwwxstmQmBr+fhUB9esyL4oYWri8xx4Y/6aK92zd7fS3ACBTs+QWNjFLCre6jADzY1u5WlrPbbjkhOTa9vzjGgbG4fLCTeaAmwBcDT0kShlX7jpWeJ9jpMpgxoaXvc8dH/QcB1znNZBeH5g4rhbSj6bZgq28s10BjBEQtFWEt0liKZsKOwuPb7msqseOjLh2zOEg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB571; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB571; 20:HFK13ebWBubL9NqWnLdLqxH+4h1KePhl6bCPhnL0TjJjaZWIAEBL+QWfFiL7BFzcOUxBb8AmLfcMk+3ixPUHlQG6Qh5oAjocGc0vLGJk8bYfcWpqs9QAM8cPhshHTzkxWACDL5DdjXjU3KWi1FoCEvf+G4XhuwMIgiWagkVfP6OqK+tzFWvxiRvsq7NV9nrZ0GKXkFiVddPheNbmShGhBJDUtjNEFxhJby238uVZmRF+O1E5x+cd0jdUxrjDw9tp8BDCApGns3lrJv488NtN+YaSgZXLHAB9ws0VBuzG9sXiEmObCciN466gtFfPB50aJK6oY1ruUsJuKL06pU2qKKAXf00e3B4rEcarXUHA0cI=; 4:jJ3mCafE+gxw+7dCZs7fHclTP1iSmdHHlTK+ASh1VvdkAXO36f6NKDZJwqBdpks5NGYllZu/1Nk9Flz8ksqMavYdZ4AenAsYqB9UfG+TTnyJ0UXQo69ufoccy9QY+3BZpoFYSXbnb+q/Pq9FMBIqiI3xG4WgM4JYX7dKVKhgxBMQ3AsMdN8weOpelPDpOB1RrBtjLElAy4kGhnyNFhBpRtMIogaEqdeH693B2NjCCY3xMn+Zz3naqFTrI6op6yzk0/hcPfvy+vGI6EboS7VDYAPpDE1XntsFvkLFOIe3RJU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BY2PR03MB571; BCL:0; PCL:0; RULEID:; SRVR:BY2PR03MB571; X-Forefront-PRVS: 06592CCE58 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR03MB571; 23:Jyz7j/wS7Wr0BPVduhDZqX5RhJUr889pcOsd8eLe9+?= =?us-ascii?Q?CyPLAZCOW5kr4J7L2bWjm+enlHKmTzeEsR9034f40zlq9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uqxKtOh17WSgfXMke1yLXPFz1If21hZKLXUoT8Tha/CPuJn9/7?= =?us-ascii?Q?jHm5eqLC0F0b1qefyP4ORdszjh1crUPHnD7YAGxw2Xih4NrNVp5zKoX7lbzS?= =?us-ascii?Q?ZQiey0LzFylhLsHsNb+FhDZpwgz9io5013Xz8vwihjve9e+Y5FImgy4Rl8Mo?= =?us-ascii?Q?4OzSJCEyv9+ow1lsVcrxbP5qAq1fDd?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB571; 5:zvC7kUW5y3nBAVeZJsRSnX1RixE4sYJIUKAVbi2fVw/jwM3XpDnWiAuQdvs1WbxN5HEpdkYjxdH1LX+qSZVPQv4diQ1Xa++6XzoSa+SS5NT/AR88B050E45IvcKKx0sgMssM3boD+SFQwIJSahzxUA==; 24:CtEcWYvAKbuk33PmNu+0nZELlHHjkuq3qx8jslENZT1qylm+JZCJgdo76sdRGhrq5M4DQrkpp5S6mccMUNZDihOTvV+c6GvoADLKPGNPIhI=; 20:njBD00sgu+ogpPn1/v2NQrnfFKN0Uufdmfd9ZUm8Z+ufAL2GQo3WkHt8UCFUXD6NBRpi/+WX34ahIVLNtlIZrQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2015 18:28:51.4776 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB571 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change fixes: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 456 at lib/dma-debug.c:1103 check_unmap+0x438/0x958() caam_jr 2101000.jr0: DMA-API: device driver frees DMA memory with different size [device address=0x000000003a241080] [map ] Modules linked in: tcrypt(+) CPU: 0 PID: 456 Comm: insmod Not tainted 4.1.0-248766-gf823586-dirty #82 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [<80015e0c>] (unwind_backtrace) from [<80012764>] (show_stack+0x10/0x14) [<80012764>] (show_stack) from [<806df8e8>] (dump_stack+0x84/0xc4) [<806df8e8>] (dump_stack) from [<800266fc>] (warn_slowpath_common+0x84/0xb4) [<800266fc>] (warn_slowpath_common) from [<8002675c>] (warn_slowpath_fmt+0x30/0x40) [<8002675c>] (warn_slowpath_fmt) from [<802c7db8>] (check_unmap+0x438/0x958) [<802c7db8>] (check_unmap) from [<802c835c>] (debug_dma_unmap_page+0x84/0x8c) [<802c835c>] (debug_dma_unmap_page) from [<804d3b94>] (ahash_update_ctx+0xb08/0xec4) [<804d3b94>] (ahash_update_ctx) from [<7f002984>] (test_ahash_pnum.isra.9.constprop.19+0x2b8/0x514 [tcrypt]) [<7f002984>] (test_ahash_pnum.isra.9.constprop.19 [tcrypt]) from [<7f005998>] (do_test+0x2db8/0x37cc [tcrypt]) [<7f005998>] (do_test [tcrypt]) from [<7f00b050>] (tcrypt_mod_init+0x50/0x9c [tcrypt]) [<7f00b050>] (tcrypt_mod_init [tcrypt]) from [<80009730>] (do_one_initcall+0x8c/0x1d4) [<80009730>] (do_one_initcall) from [<806dda4c>] (do_init_module+0x5c/0x1a8) [<806dda4c>] (do_init_module) from [<80085308>] (load_module+0x17e0/0x1da0) [<80085308>] (load_module) from [<80085998>] (SyS_init_module+0xd0/0x120) [<80085998>] (SyS_init_module) from [<8000f4c0>] (ret_fast_syscall+0x0/0x3c) ---[ end trace 60807cfb6521c79f ]--- Signed-off-by: Victoria Milhoan --- drivers/crypto/caam/caamhash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index 2361beb..16c03f8 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -829,7 +829,7 @@ static int ahash_update_ctx(struct ahash_request *req) state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1, buf, state->buf_dma, - *buflen, last_buflen); + *next_buflen, *buflen); if (src_nents) { src_map_to_sec4_sg(jrdev, req->src, src_nents,