From patchwork Sun Jan 7 12:14:22 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: 123655 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1548021qgn; Sun, 7 Jan 2018 04:17:32 -0800 (PST) X-Google-Smtp-Source: ACJfBosSvche7AEOLXaB0TBik7u8gaIdhOwacBVF0yRir+/f8uiTD4yhKTiqjovF1fKXachI8jNF X-Received: by 10.98.190.19 with SMTP id l19mr7967399pff.72.1515327452263; Sun, 07 Jan 2018 04:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515327452; cv=none; d=google.com; s=arc-20160816; b=CYvBtkdrqjRxle1mWQps5FaAULhXtJyGFZtmzDJ5XD8tCN6HmPzQBiCDyZhtY4XiEC kcAi6VrACg4kEeKdEvDM9RLBS9CYH2tppujXsFBzdaSOTziISSU3R3FWOQ9aEs2TnogY 9zaHABs06vOpT+rYzHBzojO9f91cF2RGiZKsuUvFZAAhgkuHzUQuL5R1EGXyawLtKXym /tT0Jm8uXBT7wV6mnSg2wu94VYbju48H+r4aLBbl2T4fRuCR8BMosbA8V87+lNtQyy2W JpLjC9jllAPw04qKiG5wPCgyKWYIBEu3wNju1TTjjqrSxnBiDbplCG0Lg47SftDXZ8m3 v2jg== 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=w7hgApJ5P3JZl7xGNazquDcxynAqXmz85Iq5v49MP4U=; b=zLPl04TkLbrXFnBOEGlfCAowrTsyUhXeAiyqH4FszMx45/DniXkUbt2j7jIo8JFZUN a7W+bPz0GIos8fU31Twnkv/zDwVWuz66sVfEUZDjQHsQMyIf1m1K1m/FGfStB5gaQNIJ 2qYLTmFF5JZ+qXlgVqTWzDKpQVb+IHmUbpPAuJ7KneqSDTj6fLkFaP/itzO4L8Rt62f0 podoAlAqnLGIuxnn3U6zH3QE5/XXP/YsD5+f8Jb4T5IgCaBiyYpjEcb4EY28wAeeN/Xx 1OT9O7/L7d8keekv9wByReqb/lNkmow+6UTHb1LaQL3dUrx2FTfnJDi1ij5nE535/G0n TKbA== 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 h70si6944949pfc.186.2018.01.07.04.17.32; Sun, 07 Jan 2018 04:17:32 -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 S1753997AbeAGMRa (ORCPT + 28 others); Sun, 7 Jan 2018 07:17:30 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57494 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753826AbeAGMR3 (ORCPT ); Sun, 7 Jan 2018 07:17:29 -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 B89A81435; Sun, 7 Jan 2018 04:17:28 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A84FF3F581; Sun, 7 Jan 2018 04:17:26 -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 v3 11/27] stating: ccree: revert "staging: ccree: fix leak of import() after init()" Date: Sun, 7 Jan 2018 12:14:22 +0000 Message-Id: <1515327285-8948-12-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515327285-8948-1-git-send-email-gilad@benyossef.com> References: <1515327285-8948-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 ff05ac8..ee7370c 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);