From patchwork Tue Oct 31 07:56:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 117522 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3573683qgn; Tue, 31 Oct 2017 00:56:37 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Tt8VSNZlgUXVVfjlwiQhNK349PHb1wFKiA1xunZP/QjamOnLqN7If5Sh5fo88mGWNrf59k X-Received: by 10.159.241.129 with SMTP id s1mr1096804plr.378.1509436597501; Tue, 31 Oct 2017 00:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509436597; cv=none; d=google.com; s=arc-20160816; b=aIXNGrDsuUQsZv2lU8NNZdZGecOmpZ0raKhHTfrGC9j2MH7z+qSSv4ayNdc9qEE/r1 5a3m5ANWFr1RcmCnUuT8LIn/P6h3sECPMseKCGGCD+CShggptiZhNrSxytVqJ802kSoM I5n3AMgPk/cDT9Y7NXLRnxffNDvMrbvomd0XStCOtT296/+lZjL9iA/1xTyXuoXcrLs/ wr8rqTuqKige52rQFdDBasvHxoqy5xSyDb8/3zN4F1C/4LrTfHBJjIr9lX3v2veFx43r QtWpaegcdsBzh3pVW+NjHehUHTFS7rvlohaUCUMZ8E5fmrqiO6HoFsaWvLTMMPjmSwma 5NIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dNrI6SwyFd3jqwndqEXPa1fgbJmwEyRY2rajcK7x+oA=; b=fxWyUhMam7/e0+VIXx84/VkM42v1Vp8z7fLlNDiMah8sHzb+wUhnvF83mdOh4RNUy2 b/JcYYUzvG8pwT1w2mWbwzJwkxhhjvNkN/XlxpyhvzuTYZ+RTTU7PguyeoHyjmIC/IgV ycNR+iICK0k1wrpV1XnHic2F8sUj8hWT18kd1wLy7og1777mZ/jb2JrqgBNJQEJFZnsE Zlq2OxbdczDPbOIwAafMWxUkZk2Ii3rWznrf0Zb+NmgigeMdA7B4Zzef+nSAx0HsP7o+ Xu3uAhG2CY+u3kf5iW8fQC6lDqMrkhxxTBfWCKS4SeAfRBtwW5uXcuNupeBBhM0m8RZP Y0QQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 g83si1004447pfg.161.2017.10.31.00.56.37; Tue, 31 Oct 2017 00:56:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751269AbdJaH4f (ORCPT + 1 other); Tue, 31 Oct 2017 03:56:35 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60228 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751229AbdJaH4f (ORCPT ); Tue, 31 Oct 2017 03:56:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8792780D; Tue, 31 Oct 2017 00:56:34 -0700 (PDT) Received: from sugar.kfn.arm.com (unknown [10.45.48.167]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 27FF13F24A; Tue, 31 Oct 2017 00:56:32 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: testmgr: don't allocate IV on stack Date: Tue, 31 Oct 2017 07:56:26 +0000 Message-Id: <1509436586-17500-1-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The IV was allocated on the stack in testmgr skcipher tests. Since HW based tfm providers need to DMA the IV to the HW, this leads to problems and is detected by the DMA-API debug code. Fix it by allocating the IV using kmalloc instead. Signed-off-by: Gilad Ben-Yossef --- crypto/testmgr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 7125ba3..88d0c57 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1085,12 +1085,16 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc, const char *e, *d; struct tcrypt_result result; void *data; - char iv[MAX_IVLEN]; + char *iv; char *xbuf[XBUFSIZE]; char *xoutbuf[XBUFSIZE]; int ret = -ENOMEM; unsigned int ivsize = crypto_skcipher_ivsize(tfm); + iv = kmalloc(MAX_IVLEN, GFP_KERNEL); + if (!iv) + goto out_nobuf; + if (testmgr_alloc_buf(xbuf)) goto out_nobuf; @@ -1331,6 +1335,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc, testmgr_free_buf(xoutbuf); out_nooutbuf: testmgr_free_buf(xbuf); + kfree(iv); out_nobuf: return ret; }