Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2457605yba; Mon, 15 Apr 2019 12:03:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1JIpYcFKjj7sIKcB9Dz8jeqRH9y8zWbv/eqpxHp+hCBfdKx1g+yaplIT3Rgtx7CH8tRGT X-Received: by 2002:a17:902:ac1:: with SMTP id 59mr23888068plp.294.1555355030021; Mon, 15 Apr 2019 12:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555355030; cv=none; d=google.com; s=arc-20160816; b=ImS6IB7OF1axQEd3I7baxhYCFVxr6t6yplmvqIDtmNjexk8FyOYo+6DLXjG5ogXXln 0FoDT9YVQSwU6AFZCKT3UVdr2ToW3sBNgYRP4JTjHbjmjj+gnuW9mNXzyg4oXskRmDio HCAXN+5NOqBvdAjLJP58xjNJ/SF8jFb41dZC7hGv/3E6r3XCJAj22FmxXdHrtfbtoiT8 RWBdUm7YzP1fyQ58TEyK92I8FWFlmsQK9FLXaARyMboZV40MG7Guy6j6PbpHFu9qjc2I pCdAN3IIF756rSLuGYaqhLxhjW0kdrMTMybRqhrFeU5qM8DZ0f/RJcUpZS2SZZVV6Qx1 rdcw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DnK7TG/X8buNe4YnOVo1/6vSlknSoVddP87mNwPBu+w=; b=WWNCbfqdnTGjph+9wA6hqLFDUuUjuM0GPVOVyzHQQM+0phobh4sDjHtEGXq1TVLG9F KXXj8WZa8MI2VRwwSuHtSzB79nyjlNjTh2Z6cxjeQsmGLurpB+cGiSAKM10hTilzFXYJ jsDxLvymgSxFJCdzeM1t3RnGFH1FK62qeH1e0SyIb2rCVl0YBvdbbSpPC0mavV59yOrj 4C+rTldQqf5yNrhSpBb14Zz8oh1nErqUbAPKqtrkQaX6j4KNxjEjdshbmrp/bERsMwvI 0MNZKG+fs7Ddon0XAtqOIpI5utNjBEr1rlNEn1l8/7dMTIrIr08lgpTk8hm3ZxeyyYtf cUzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n8K3BJ3B; 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 j91si12312279pld.199.2019.04.15.12.03.33; Mon, 15 Apr 2019 12:03:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=n8K3BJ3B; 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 S1728877AbfDOTCh (ORCPT + 99 others); Mon, 15 Apr 2019 15:02:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:33616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728826AbfDOTCe (ORCPT ); Mon, 15 Apr 2019 15:02:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0B7A7218FE; Mon, 15 Apr 2019 19:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354953; bh=n5zIPqcgnEyuOKbun8EqKo4ofJRZ2hzchfw0q0toRcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8K3BJ3Bt9IVgxsqi4DwMgpuEmvTFsksCGNKLcSEcVaGY5mgCkiltoR+/6r5otGaA Cj4wPAh/FdIoVAOP4ANwSio2hTWBoEmSQyqmQM3Qj7cEFT6USSmowprCpP4gerlqsI RVcdFnyowr6m27j/tJCMPJVdtcnfY3US/AOrAaYY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gilad Ben-Yossef , Sudip Mukherjee , Sasha Levin Subject: [PATCH 4.14 12/69] stating: ccree: revert "staging: ccree: fix leak of import() after init()" Date: Mon, 15 Apr 2019 20:58:30 +0200 Message-Id: <20190415183729.200456534@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 293edc27f8bc8a44978e9e95902b07b74f1c7523 upstream 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sudip Mukherjee Signed-off-by: Sasha Levin --- drivers/staging/ccree/ssi_hash.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index e266a70a1b32..13291aeaf350 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1781,7 +1781,7 @@ static int ssi_ahash_import(struct ahash_request *req, const void *in) struct device *dev = &ctx->drvdata->plat_dev->dev; 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) { @@ -1790,12 +1790,9 @@ static int ssi_ahash_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 = ssi_hash_init(state, ctx); - if (rc) - goto out; - } + rc = ssi_hash_init(state, ctx); + if (rc) + goto out; dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); -- 2.19.1