Re: [PATCH v2] crypto: ccp - Release all allocated memory if sha type is invalid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxx>

Acked-by: Gary R Hook <gary.hook@xxxxxxx>

> ---
>   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));





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux