Skip to content

Commit

Permalink
crypto: ccp - Release all allocated memory if sha type is invalid
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Navidem authored and herbertx committed Oct 4, 2019
1 parent a7174f9 commit 128c664
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/crypto/ccp/ccp-ops.c
Expand Up @@ -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));
Expand Down

0 comments on commit 128c664

Please sign in to comment.