Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1193065pxa; Thu, 20 Aug 2020 05:16:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9A5qSaXt6s86XI2wJo3LBBZb3ca4lzw2b+X0aYYKJrWGwWO/z1FKnAqXg2mqOWW+WPa8y X-Received: by 2002:a17:906:1a0f:: with SMTP id i15mr3115353ejf.293.1597925776475; Thu, 20 Aug 2020 05:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597925776; cv=none; d=google.com; s=arc-20160816; b=h/tJcRwr8yxoQo2f8qer8AbvQKzwe/S06B0c924zw06cJGPxvpCmofC4IcAn8s9R49 OhNRybYvI8MtwnbGR9QPTSMyMo5P0mzsjJHwFJFUs9kU1pEV/29Kewb0vQfdy15TY3ap +e5qFNTIpombrkM+5teR1pY9zhor7rBnwUo0zHBvpIdXd1qENhVV6R7jgtdGw5vFF5a0 EV46USWee+cQjwkjoNvwOyOB+G47RiGFd3D9TOTjCJcJBzFlL8/2KFHROvhJW/EhBbJd f66GAD9Tm3cbEURFmhHG5J5veXMG1ET5GKRXdhVehtCwRbaSiW59sDfs5LOgbvWLRl6W jT9Q== 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=qMxvl42RPYnc87+2XzKBDfU9z5Rvf5AYoYEu1MM4qkU=; b=ysk8vUZ0kJ+CTsEfui2dxBZkDpbi2QS5x+PIqYBGk6Yz+jFGOPKefROpSshdvgSGDE L85RYbCpHtZIvBC4loBoqGrp/FVkUlR4JpjFVAp/7RilmApSKhNLMYeait4M+OXsgFPJ 4F1CrCrtMHt7viyL31PHkRUSWL09HPWA7PdxhIJNR8eeydN5am0kKLl9Mxh1ZbPWHmIe fFNRa4oDFAuHXWIptsz33MWIdeCO0qB/PuQR+68CllXSr7C+267xcWhoT3mDiU7JKsNg oFLVhdKQlQB8e2wQ1rHnCDBGj/M+L3PBP4JyQx0RDlA+oC9v1Yx8nea8a7nzY9VKaSDM +prw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TmrGpTer; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h27si1411034edj.279.2020.08.20.05.15.51; Thu, 20 Aug 2020 05:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TmrGpTer; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730304AbgHTMNG (ORCPT + 99 others); Thu, 20 Aug 2020 08:13:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:41246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730185AbgHTJ51 (ORCPT ); Thu, 20 Aug 2020 05:57:27 -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 7C65D22CAD; Thu, 20 Aug 2020 09:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597917447; bh=TBVknhZVyjDgRUX1egicX7fhjQ9CedC2sJRWeg3JK24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TmrGpTerFwrnV76lQ6wiBhwSxHspUA1n4uVPJDc2u3WbvC0sgYhZ/OCnF+1CjNspe k4IuKOFOo2hGgZU9jRSeT/qxNubCdjTLN/2bYZdhpKTrqBmot6ONGkE/2KWSIns4hS ljG3GqnOYBYaPgEaaCHS6PZSPC+3Yj1vxdHMY/zU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Gary R Hook , Herbert Xu , Sasha Levin Subject: [PATCH 4.9 005/212] crypto: ccp - Release all allocated memory if sha type is invalid Date: Thu, 20 Aug 2020 11:19:38 +0200 Message-Id: <20200820091602.527206018@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091602.251285210@linuxfoundation.org> References: <20200820091602.251285210@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 From: Navid Emamdoost [ Upstream commit 128c66429247add5128c03dc1e144ca56f05a4e2 ] Release all allocated memory if sha type is invalid: In ccp_run_sha_cmd, if the type of sha is invalid, the allocated hmac_buf should be released. v2: fix the goto. Signed-off-by: Navid Emamdoost Acked-by: Gary R Hook Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/ccp-ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index 7d4cd518e6022..723f0a0cb2b5b 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -1216,8 +1216,9 @@ static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) digest_size); break; default: + kfree(hmac_buf); ret = -EINVAL; - goto e_ctx; + goto e_data; } memset(&hmac_cmd, 0, sizeof(hmac_cmd)); -- 2.25.1