From patchwork Thu Apr 18 13:38:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 162486 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp761886jan; Thu, 18 Apr 2019 06:41:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqykLrWjYve7E0kJzZSGgKnDBuHjCELeTehqslgIe5+oBzDLCYOlG7NFeA1YsceFXWj140EL X-Received: by 2002:aa7:92d5:: with SMTP id k21mr95941324pfa.223.1555594878966; Thu, 18 Apr 2019 06:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555594878; cv=none; d=google.com; s=arc-20160816; b=xjfM+Zotoh9BDsVRUFyymgAL7sVePRvrcwZlk1E7SV+Wicn+f1H4jVe00EDXzvbHF7 bvqJ5YrzdRifRwavgpWXU3bYcyIyZahATNOdM/2I1IgDK3UBi4t24ZS/bikUNtwcrup4 cLwu9PIGbfg47d1rgRHSlu/GDy+g4YnNXoBwXsQmf6MZ2V65493zwJ4NyG9MLgy5+RVK RDoPjb/iSEVTx8Ny2S8v2+AZ8DHtfmFAXGFDGPa0VHEV4YSG+dP/qe0O8pkSVSmMN2D/ CiTMeslGyMylrmpGq5+1gM/d19lkN98k5l6LZCs358HOPoFiWQ/bx76nSplZ7Ir+K/lc TWIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iH4ZEdGnnj3HZSuxiniIoqXGLnzYvl0TPsaNegRjo8Q=; b=B0yYUz17Xj7BKl64XZZljTB9GuJJxL1Njs3XQgndNcawwTbhqX+QZkZ2dBrp2RQfIU fizG5mFwQ3ozffn43VXeqffEi6NQKCIpfjZIeTwFa8REiQPzg2giAKKmKjkjXxkltWwY op/aWPdN/DFQ1GlZ/5OowthKyl86VoTwaporba9AxbqkFG0up6RjSr6U2IF+6tv4rr1w ZCLPTkALQ6fje5CWdi2M+Nkb6dG+dVyKdhxik3pDbwjgfRPl63zy3PK6iIO8JepcDuHf IRDU/94djNwQXTBGoMDD+bna/rId1x4DJc4tWYtdIQ5YQPz1i8eiR1F316jaaCjeB3XR fcig== 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 k12si1898621pgi.107.2019.04.18.06.41.18; Thu, 18 Apr 2019 06:41:18 -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 S2388582AbfDRNlR (ORCPT + 30 others); Thu, 18 Apr 2019 09:41:17 -0400 Received: from foss.arm.com ([217.140.101.70]:33656 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388375AbfDRNlP (ORCPT ); Thu, 18 Apr 2019 09:41:15 -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 938DF1688; Thu, 18 Apr 2019 06:41:15 -0700 (PDT) Received: from e110176-lin.kfn.arm.com (e110176-lin.kfn.arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 27D743F5AF; Thu, 18 Apr 2019 06:41:13 -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 20/35] crypto: ccree: do not copy zero size MLLI table Date: Thu, 18 Apr 2019 16:38:55 +0300 Message-Id: <20190418133913.9122-21-gilad@benyossef.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418133913.9122-1-gilad@benyossef.com> References: <20190418133913.9122-1-gilad@benyossef.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we are given a 0 sized cryptlen and assoclen in a scatterlist with two entries we were falsely trying to create a zero length MLLI table, causing the HW to choke. Don't try to copy a zero sized MLLI table. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.21.0 diff --git a/drivers/crypto/ccree/cc_aead.c b/drivers/crypto/ccree/cc_aead.c index 0fa676b5603c..0e8d2381c175 100644 --- a/drivers/crypto/ccree/cc_aead.c +++ b/drivers/crypto/ccree/cc_aead.c @@ -1163,9 +1163,9 @@ static void cc_mlli_to_sram(struct aead_request *req, struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); struct device *dev = drvdata_to_dev(ctx->drvdata); - if (req_ctx->assoc_buff_type == CC_DMA_BUF_MLLI || + if ((req_ctx->assoc_buff_type == CC_DMA_BUF_MLLI || req_ctx->data_buff_type == CC_DMA_BUF_MLLI || - !req_ctx->is_single_pass) { + !req_ctx->is_single_pass) && req_ctx->mlli_params.mlli_len) { dev_dbg(dev, "Copy-to-sram: mlli_dma=%08x, mlli_size=%u\n", (unsigned int)ctx->drvdata->mlli_sram_addr, req_ctx->mlli_params.mlli_len);