* [patch] crypto: ccp - Free ccp if initialization fails
@ 2019-06-23 19:18 David Rientjes
2019-06-24 13:04 ` Lendacky, Thomas
0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2019-06-23 19:18 UTC (permalink / raw)
To: Tom Lendacky, Gary Hook, Herbert Xu
Cc: Brijesh Singh, Cfir Cohen, linux-kernel, linux-crypto
If ccp_dev_init() fails, kfree() the allocated ccp since it will otherwise
be leaked.
Fixes: 720419f01832 ("crypto: ccp - Introduce the AMD Secure Processor
device")
Reported-by: Cfir Cohen <cfir@google.com>
Signed-off-by: David Rientjes <rientjes@google.com>
---
drivers/crypto/ccp/ccp-dev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
--- a/drivers/crypto/ccp/ccp-dev.c
+++ b/drivers/crypto/ccp/ccp-dev.c
@@ -609,6 +609,7 @@ int ccp_dev_init(struct sp_device *sp)
e_err:
sp->ccp_data = NULL;
+ kfree(ccp);
dev_notice(dev, "ccp initialization failed\n");
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] crypto: ccp - Free ccp if initialization fails
2019-06-23 19:18 [patch] crypto: ccp - Free ccp if initialization fails David Rientjes
@ 2019-06-24 13:04 ` Lendacky, Thomas
2019-06-24 14:58 ` Gary R Hook
0 siblings, 1 reply; 3+ messages in thread
From: Lendacky, Thomas @ 2019-06-24 13:04 UTC (permalink / raw)
To: David Rientjes, Hook, Gary, Herbert Xu
Cc: Singh, Brijesh, Cfir Cohen, linux-kernel, linux-crypto
On 6/23/19 2:18 PM, David Rientjes wrote:
> If ccp_dev_init() fails, kfree() the allocated ccp since it will otherwise
> be leaked.
Not needed. It's allocated with devm_kzalloc(), so it won't be leaked.
Thanks,
Tom
>
> Fixes: 720419f01832 ("crypto: ccp - Introduce the AMD Secure Processor
> device")
>
> Reported-by: Cfir Cohen <cfir@google.com>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
> drivers/crypto/ccp/ccp-dev.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
> --- a/drivers/crypto/ccp/ccp-dev.c
> +++ b/drivers/crypto/ccp/ccp-dev.c
> @@ -609,6 +609,7 @@ int ccp_dev_init(struct sp_device *sp)
>
> e_err:
> sp->ccp_data = NULL;
> + kfree(ccp);
>
> dev_notice(dev, "ccp initialization failed\n");
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] crypto: ccp - Free ccp if initialization fails
2019-06-24 13:04 ` Lendacky, Thomas
@ 2019-06-24 14:58 ` Gary R Hook
0 siblings, 0 replies; 3+ messages in thread
From: Gary R Hook @ 2019-06-24 14:58 UTC (permalink / raw)
To: Lendacky, Thomas, David Rientjes, Hook, Gary, Herbert Xu
Cc: Singh, Brijesh, Cfir Cohen, linux-kernel, linux-crypto
On 6/24/19 8:04 AM, Lendacky, Thomas wrote:
> On 6/23/19 2:18 PM, David Rientjes wrote:
>> If ccp_dev_init() fails, kfree() the allocated ccp since it will otherwise
>> be leaked.
>
> Not needed. It's allocated with devm_kzalloc(), so it won't be leaked.
>
> Thanks,
> Tom
Nacked-By: Gary R Hook <gary.hook@amd.com>
>
>>
>> Fixes: 720419f01832 ("crypto: ccp - Introduce the AMD Secure Processor
>> device")
>>
>> Reported-by: Cfir Cohen <cfir@google.com>
>> Signed-off-by: David Rientjes <rientjes@google.com>
>> ---
>> drivers/crypto/ccp/ccp-dev.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
>> --- a/drivers/crypto/ccp/ccp-dev.c
>> +++ b/drivers/crypto/ccp/ccp-dev.c
>> @@ -609,6 +609,7 @@ int ccp_dev_init(struct sp_device *sp)
>>
>> e_err:
>> sp->ccp_data = NULL;
>> + kfree(ccp);
>>
>> dev_notice(dev, "ccp initialization failed\n");
>>
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-24 14:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-23 19:18 [patch] crypto: ccp - Free ccp if initialization fails David Rientjes
2019-06-24 13:04 ` Lendacky, Thomas
2019-06-24 14:58 ` Gary R Hook
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).