From patchwork Mon Jan 1 12:06:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 123042 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7796458qgn; Mon, 1 Jan 2018 04:09:22 -0800 (PST) X-Google-Smtp-Source: ACJfBovl5SbyBT0cG6S11qXah+yOCUOoutcXN0bZuP/MB50iCwXW1TpDBP8urvfgE+Ko1VGh1yfH X-Received: by 10.159.197.1 with SMTP id bj1mr43583505plb.118.1514808562184; Mon, 01 Jan 2018 04:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514808562; cv=none; d=google.com; s=arc-20160816; b=Z/2cNa6Fi2U4LdaSTwXJ4HOncBqpg08IO8k2tzQlGg5JStuf0mcLbP+oAhHTvtGFGV 422yM6ebSKuv/wJ9h+NpWUdJrucejbfMjiQodXSwvC9jcIisSp2LHri4e2vcgl//cxN6 GEz6KQHSKTozqRp/seoatoWKLkC2vlMUs4W1H7kcRDD4y54iDqd2O+qhLXxKFbqURN/P Div2xFwcKz5UQoN72Va+ron55n8XaLkcapVCtz6I4O7QaeXrKpwHAW+0GuCBu5PrXFPG Hki01nfp7X83Kl8pqVjVAdBYfFyGX64BWRYfecWMomjCuCh+uZxscnncskd1YDX0pcez V0Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=UCw2RWHxm91CMtZSm8PIcwEMPJ69V9nYpVdaAnfwuwE=; b=WxNH7bFgknW7iO2K4fYUMrY+c3o/+Thc4rTIuY3IzfYyF96wX/o9EeQkzZXuKW7ZE3 tkZSjk8EbM4E+jDZuroIFYOm6QiBGZQOcilGCPPFMXlOC9oAHfV0kJjjBYdja2FW49GP ZomvMgn+I8IwQtvum26quFdB8/Q5rDYUzL6OleWqtyipTow1sC7kGBujKjZhgZ4Dyxpz aRUNN+91+CbODv2upP28r44GLQXaJEeZv952HCebI+7FEuKAZ2Z7/Oy/dvlWxsEBLprB oXwco6PQWDZgev+ET2L3j+47oHNGFHUGqQLT19JYgCsIabCIPYkPhKyOUH6qZHTjgimZ uz9Q== 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 g5si32007403plo.366.2018.01.01.04.09.21; Mon, 01 Jan 2018 04:09:22 -0800 (PST) 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 S1751522AbeAAMJR (ORCPT + 28 others); Mon, 1 Jan 2018 07:09:17 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59136 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751088AbeAAMJO (ORCPT ); Mon, 1 Jan 2018 07:09:14 -0500 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 75CDB80D; Mon, 1 Jan 2018 04:09:14 -0800 (PST) Received: from sugar.kfn.arm.com (unknown [10.45.48.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D3D93F41F; Mon, 1 Jan 2018 04:09:11 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org Subject: [PATCH 11/26] stating: ccree: revert "staging: ccree: fix leak of import() after init()" Date: Mon, 1 Jan 2018 12:06:38 +0000 Message-Id: <1514808421-21993-12-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514808421-21993-1-git-send-email-gilad@benyossef.com> References: <1514808421-21993-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit c5f39d07860c ("staging: ccree: fix leak of import() after init()") and commit aece09024414 ("staging: ccree: Uninitialized return in ssi_ahash_import()"). This is the wrong solution and ends up relying on uninitialized memory, although it was not obvious to me at the time. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index cc11344..9d71b33 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1673,7 +1673,7 @@ static int cc_hash_import(struct ahash_request *req, const void *in) struct device *dev = drvdata_to_dev(ctx->drvdata); struct ahash_req_ctx *state = ahash_request_ctx(req); u32 tmp; - int rc = 0; + int rc; memcpy(&tmp, in, sizeof(u32)); if (tmp != CC_EXPORT_MAGIC) { @@ -1682,12 +1682,9 @@ static int cc_hash_import(struct ahash_request *req, const void *in) } in += sizeof(u32); - /* call init() to allocate bufs if the user hasn't */ - if (!state->digest_buff) { - rc = cc_hash_init(req); - if (rc) - goto out; - } + rc = cc_hash_init(req); + if (rc) + goto out; dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL);