lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Nov 2022 11:14:42 +0200
From:   Gal Pressman <gal@...dia.com>
To:     Yu Liao <liaoyu15@...wei.com>, borisp@...dia.com,
        john.fastabend@...il.com, kuba@...nel.org, pabeni@...hat.com,
        edumazet@...gle.com, davem@...emloft.net
Cc:     liwei391@...wei.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2] net/tls: Fix memory leak in tls_enc_skb() and
 tls_sw_fallback_init()

On 10/11/2022 11:03, Yu Liao wrote:
> 'aead_req' and 'aead_send' is allocated but not freed in default switch
> case. This commit fixes the potential memory leak by freeing them under
> the situation.
>
> Fixes: ea7a9d88ba21 ("net/tls: Use cipher sizes structs")
> Signed-off-by: Yu Liao <liaoyu15@...wei.com>
> ---
> v1->v2: Also fix memory leak in tls_sw_fallback_init().
>
>  net/tls/tls_device_fallback.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c
> index cdb391a8754b..7fbb1d0b69b3 100644
> --- a/net/tls/tls_device_fallback.c
> +++ b/net/tls/tls_device_fallback.c
> @@ -346,7 +346,7 @@ static struct sk_buff *tls_enc_skb(struct tls_context *tls_ctx,
>  		salt = tls_ctx->crypto_send.aes_gcm_256.salt;
>  		break;
>  	default:
> -		return NULL;
> +		goto free_req;
>  	}
>  	cipher_sz = &tls_cipher_size_desc[tls_ctx->crypto_send.info.cipher_type];
>  	buf_len = cipher_sz->salt + cipher_sz->iv + TLS_AAD_SPACE_SIZE +
> @@ -492,7 +492,8 @@ int tls_sw_fallback_init(struct sock *sk,
>  		key = ((struct tls12_crypto_info_aes_gcm_256 *)crypto_info)->key;
>  		break;
>  	default:
> -		return -EINVAL;
> +		rc = -EINVAL;
> +		goto free_aead;
>  	}
>  	cipher_sz = &tls_cipher_size_desc[crypto_info->cipher_type];
>  

Thanks!
Reviewed-by: Gal Pressman <gal@...dia.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ