lkml.org 
[lkml]   [2019]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH v2] crypto: ccp - Release all allocated memory if sha type is invalid
Date


On 9/19/19 11:04 AM, Navid Emamdoost wrote:
> 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>

> ---
> drivers/crypto/ccp/ccp-ops.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
> index 9bc3c62157d7..440df9208f8f 100644
> --- a/drivers/crypto/ccp/ccp-ops.c
> +++ b/drivers/crypto/ccp/ccp-ops.c
> @@ -1782,8 +1782,9 @@ static int 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));

\
 
 \ /
  Last update: 2019-09-19 19:01    [W:0.197 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site