mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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

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

all inboxes | Powered by JetHome®