linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gary R Hook <ghook@amd.com>
To: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	Navid Emamdoost <navid.emamdoost@gmail.com>
Cc: "emamd001@umn.edu" <emamd001@umn.edu>,
	"smccaman@umn.edu" <smccaman@umn.edu>,
	"kjlu@umn.edu" <kjlu@umn.edu>, "Hook, Gary" <Gary.Hook@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] crypto: ccp - release hmac_buf if ccp_run_sha_cmd fails
Date: Thu, 19 Sep 2019 13:29:17 +0000	[thread overview]
Message-ID: <7ffc6a77-f4e3-7db9-4ec6-53d6e01d881d@amd.com> (raw)
In-Reply-To: <3550c7a3-2932-c222-c1b3-957def794150@amd.com>

On 9/16/19 8:22 AM, Lendacky, Thomas wrote:
> On 9/13/19 6:48 PM, Navid Emamdoost wrote:
>> In ccp_run_sha_cmd, if the type of sha is invalid, the allocated
>> hmac_buf should be released.
>>
>> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
>> ---
>>   drivers/crypto/ccp/ccp-ops.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
>> index 9bc3c62157d7..cff16f0cc15b 100644
>> --- a/drivers/crypto/ccp/ccp-ops.c
>> +++ b/drivers/crypto/ccp/ccp-ops.c
>> @@ -1782,6 +1782,7 @@ static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
>>   			       LSB_ITEM_SIZE);
>>   			break;
>>   		default:
>> +			kfree(hmac_buf);
> Well, theoretically we can never reach this section since the routine
> would have never proceeded past the first switch statement at the
> beginning of the function. But, if the code is ever modified and some of
> the switch statements missed then it's possible...
>
>>   			ret = -EINVAL;
>>   			goto e_ctx;
> I know it's not part of your change, but this looks like it should be
> goto e_data instead of e_ctx, too.
I agree with this. Please resubmit with the suggested change, and use a 
commit message along the the lines of

crypto: ccp - Release all allocated memory if sha type is invalid


Gary

  reply	other threads:[~2019-09-19 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 23:48 [PATCH] crypto: ccp - release hmac_buf if ccp_run_sha_cmd fails Navid Emamdoost
2019-09-16 13:22 ` Lendacky, Thomas
2019-09-19 13:29   ` Gary R Hook [this message]
2019-09-19 16:04     ` [PATCH v2] crypto: ccp - Release all allocated memory if sha type is invalid Navid Emamdoost
2019-09-19 17:00       ` Gary R Hook
2019-10-04 15:44       ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ffc6a77-f4e3-7db9-4ec6-53d6e01d881d@amd.com \
    --to=ghook@amd.com \
    --cc=Gary.Hook@amd.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=davem@davemloft.net \
    --cc=emamd001@umn.edu \
    --cc=herbert@gondor.apana.org.au \
    --cc=kjlu@umn.edu \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navid.emamdoost@gmail.com \
    --cc=smccaman@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).