Skip to content

Commit 128c664

Browse files
Navidemherbertx
authored andcommitted
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>
1 parent a7174f9 commit 128c664

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: drivers/crypto/ccp/ccp-ops.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1777,8 +1777,9 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
17771777
LSB_ITEM_SIZE);
17781778
break;
17791779
default:
1780+
kfree(hmac_buf);
17801781
ret = -EINVAL;
1781-
goto e_ctx;
1782+
goto e_data;
17821783
}
17831784

17841785
memset(&hmac_cmd, 0, sizeof(hmac_cmd));

0 commit comments

Comments
 (0)