Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2027370pxa; Mon, 3 Aug 2020 05:45:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMyXgPr9PLDLU4c1dd2WnVXrcBlvvLKHDGOqZvBumRDPtNNK8OqDPZkJ98Xt+4xlkfYd4C X-Received: by 2002:a17:906:60c6:: with SMTP id f6mr15651404ejk.265.1596458745621; Mon, 03 Aug 2020 05:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596458745; cv=none; d=google.com; s=arc-20160816; b=uxQRlDaybOcoo2vIwzVJtxmhHIiGCp5793/ZRkBkO2Q/YTpHDOVM9WRUyaIYr5VAAh LZRXvYm5Wc0H0CnaRIJ/4GgvKFRW4uzTHDg9OwwOOWJiw2ed9nN/PSWH4+fa/0/LwKU3 Uo+2nAvmyNTiXmh2+QB9/e0O7RfAPvWz71udV4/leQjaMOXiRIdaTD9+IOr4Gba5eyhi kNwPidlcFNe6gg861JdJrIP359PEFKQVwo2quYjMoWsV4o+iMU/po+2K+1qVQGes+PjC bntTKtdSUNpNS74kSzXRtAEX6pFfOI/8dQVClJzqCYCahjD69z8BGwZN4Wkc7qu/qoBR t/uA== 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=5xYgTMPeRa0HcXZxZjGbrmlIqxaxJe0F5m+hgI//Y7M=; b=emkk2X38ZugYETYro78pJA3Jz/Kpo0FTSWfp0dA4fDCsoiJ1iI4GwcZxv1U+JBEZBD FEBPk3l/y71C1ksQtKiMoVxqOAFZBxg+dtp0b01bMjVTzF4rkv+0mwvgb08+wrAV5x8q yEUa1dUz0t3K0ovFZuzp3u4xb1llPAad4jhUuWAngdbp/pTfF5XSVcd3mz3Psl13JG2W q6OB1SeLPMgSMtrtYiJQSJMOOTqwBWmjKPrJnQx4qPrmWFX1cV+wh6CYpR7dyU9N3K0i gQAEqBLRqPeFV6wfMyDFiv0fmyfjrFXGwKQh/oGjtCHTth7S4gjruacBll4R5MesPqYo J5bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JTyP+dJv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si10438805edw.303.2020.08.03.05.45.23; Mon, 03 Aug 2020 05:45:45 -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=JTyP+dJv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729461AbgHCMmq (ORCPT + 99 others); Mon, 3 Aug 2020 08:42:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:58316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729133AbgHCMbB (ORCPT ); Mon, 3 Aug 2020 08:31:01 -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 06FEB2076B; Mon, 3 Aug 2020 12:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596457860; bh=C8PD6oRY0Isp66vleS6E1szTsB0xCyrvx6x4AqQUzOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JTyP+dJvcLHvfHis2NYLcKnxMtXjOdgZFm9AKlmgF1QShiAsVHYf7cWzwR8mrwZ/u 1mAxP6EnYPL5D+PO7XlnSWOd+bjzBRgjai6wD2dSqreicYzamzk7lEpiNH3ej26s4E NMtDSGYUIyfPVq0HALJ5J0oWPjPKt4ccHt99/ASw= 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.19 01/56] crypto: ccp - Release all allocated memory if sha type is invalid Date: Mon, 3 Aug 2020 14:19:16 +0200 Message-Id: <20200803121850.381405558@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803121850.306734207@linuxfoundation.org> References: <20200803121850.306734207@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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 330853a2702f0..43b74cf0787e1 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -1783,8 +1783,9 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) LSB_ITEM_SIZE); break; default: + kfree(hmac_buf); ret = -EINVAL; - goto e_ctx; + goto e_data; } memset(&hmac_cmd, 0, sizeof(hmac_cmd)); -- 2.25.1