From patchwork Mon May 20 12:14:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 164620 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp231258ili; Mon, 20 May 2019 05:34:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHnQEDs96VK3Kq1MzAcQqGgXdlU/ZjDAJGgxQT9CvVVarthBTehCeuhIesuJ7gkVvBuE+D X-Received: by 2002:a17:902:ab97:: with SMTP id f23mr21130079plr.237.1558355681890; Mon, 20 May 2019 05:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355681; cv=none; d=google.com; s=arc-20160816; b=hlWa13Bpa6aHBKyDbcSMYbu7UZSYQgL+esMLjhUAnkywu+5wOyXEjxoRRAtd7KC3si WGZbYzlV/bHXeWF6Rgj8+cDMa+JAfgxePbDpJTzZIOkb7UtbO+BjiFbN0dC8iEQCn6J/ 07RGv5P9WK9UprnCf/Ahf2uf1gFG5t8V6tgux39scb0dmEdygiRFEmo3Lk2MQcHXh9Uy TS7r5Pmki1unhKIwqAoSo0O1cfgMRhlJabOP5T8v1Ccg7JJjIzo+qjmluu9Xp8W/VkQ7 gg6rWG2rxaN+Ii0SqyMumnzN/AeCCDZZr5+Avyr00eFbEowsruMY6FhRmul2wEtmCabs ivgw== 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=TEOjFFbIAKtWDVj7b5kOGp66OjQtTgLzbcPkVCXl414=; b=pDzYGhp/NDF/dB3oINSaA5eBnFJoLp9qCJhET1OShVGjUpHuQ0eoWy7QU3xloSqm0M iSEf4+q2Snd+Po/emwcDxYbNw9ie3WIBYSe2oCwCkiMlOnCqIh5WGtrvWHXyACjOCvI6 n2D0BqzvS1ll0X8uHQ7ygYro2Jz5JD+ymFKIiQyCNMjqQM7L3pzv2EYewiewuC4Tf0m0 jtxre5Fh9NwYJh7cj/kq+XPb380R/5vPG8qwRUyqhhHhc75f/oXR1BcPd7yV/vOvrkv3 IPJXnzUla3qj1BqN47Kl5c8QyeF57iBV/Ymzg1WYocKimJKwyk7SnxylZEDbD4Cptc91 v8fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J4kYahhF; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 e11si12396932pgv.569.2019.05.20.05.34.40; Mon, 20 May 2019 05:34:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=J4kYahhF; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390745AbfETMdj (ORCPT + 14 others); Mon, 20 May 2019 08:33:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:50794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390765AbfETMdj (ORCPT ); Mon, 20 May 2019 08:33:39 -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 E0F0E216C4; Mon, 20 May 2019 12:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355618; bh=Vc76SIEwx46ODrXQqltdqyN2/mHnKSGbQiibyzx/1hQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J4kYahhFHF1r74se7oM3JY3HDY6DSQttBkRL8t5EURYdEuIY2BrNYPgNwt15ASQPH 0iKS6WM7j54EftE7IqBZbcf/Sag1rkjrx42LF7cDuStfzpImqk3sJumLzW06lBGjYK MCzB5IOIoZMvdP6LXnePY4Y/iy7Z9hyDsdTvJpR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gilad Ben-Yossef , Herbert Xu Subject: [PATCH 5.1 061/128] crypto: ccree - fix mem leak on error path Date: Mon, 20 May 2019 14:14:08 +0200 Message-Id: <20190520115253.906358503@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gilad Ben-Yossef commit d574b707c873d6ef1a2a155f8cfcfecd821e9a2e upstream. Fix a memory leak on the error path of IV generation code. Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccree/cc_ivgen.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) --- a/drivers/crypto/ccree/cc_ivgen.c +++ b/drivers/crypto/ccree/cc_ivgen.c @@ -154,9 +154,6 @@ void cc_ivgen_fini(struct cc_drvdata *dr } ivgen_ctx->pool = NULL_SRAM_ADDR; - - /* release "this" context */ - kfree(ivgen_ctx); } /*! @@ -174,10 +171,12 @@ int cc_ivgen_init(struct cc_drvdata *drv int rc; /* Allocate "this" context */ - ivgen_ctx = kzalloc(sizeof(*ivgen_ctx), GFP_KERNEL); + ivgen_ctx = devm_kzalloc(device, sizeof(*ivgen_ctx), GFP_KERNEL); if (!ivgen_ctx) return -ENOMEM; + drvdata->ivgen_handle = ivgen_ctx; + /* Allocate pool's header for initial enc. key/IV */ ivgen_ctx->pool_meta = dma_alloc_coherent(device, CC_IVPOOL_META_SIZE, &ivgen_ctx->pool_meta_dma, @@ -196,8 +195,6 @@ int cc_ivgen_init(struct cc_drvdata *drv goto out; } - drvdata->ivgen_handle = ivgen_ctx; - return cc_init_iv_sram(drvdata); out: