Commit 128c6642 authored by Navid Emamdoost's avatar Navid Emamdoost Committed by Herbert Xu

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: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: default avatarGary R Hook <gary.hook@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a7174f97
...@@ -1777,8 +1777,9 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) ...@@ -1777,8 +1777,9 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
LSB_ITEM_SIZE); LSB_ITEM_SIZE);
break; break;
default: default:
kfree(hmac_buf);
ret = -EINVAL; ret = -EINVAL;
goto e_ctx; goto e_data;
} }
memset(&hmac_cmd, 0, sizeof(hmac_cmd)); memset(&hmac_cmd, 0, sizeof(hmac_cmd));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment