summaryrefslogtreecommitdiff
path: root/drivers/crypto/ccp
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-09-19 19:04:48 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2019-10-04 18:06:20 +0300
commit128c66429247add5128c03dc1e144ca56f05a4e2 (patch)
treec533fb093d215eff2a2c388d8b8a0a219ed70856 /drivers/crypto/ccp
parenta7174f978563e112fcd8601c9f8b4a9ddef3388d (diff)
downloadlinux-128c66429247add5128c03dc1e144ca56f05a4e2.tar.xz
crypto: ccp - Release all allocated memory if sha type is invalid
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 <navid.emamdoost@gmail.com> Acked-by: Gary R Hook <gary.hook@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp')
-rw-r--r--drivers/crypto/ccp/ccp-ops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
index c8da8eb160da..422193690fd4 100644
--- a/drivers/crypto/ccp/ccp-ops.c
+++ b/drivers/crypto/ccp/ccp-ops.c
@@ -1777,8 +1777,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));