lkml.org 
[lkml]   [2019]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] crypto: ccp - Free ccp if initialization fails
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");

\
 
 \ /
  Last update: 2019-06-23 21:19    [W:0.028 / U:4.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site