Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Ramin Farajpour Cami <ramin.blackhat@gmail.com>, davem@davemloft.net
Cc: herbert@gondor.apana.org.au, steffen.klassert@secunet.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH] net: esp4: Fix double free on esp4 functions
Date: Wed, 30 Jan 2019 15:07:52 -0800	[thread overview]
Message-ID: <38d987a0-7cc4-1565-00d4-22fdd04d7894@gmail.com> (raw)
In-Reply-To: <20190130213542.17313-1-ramin.blackhat@gmail.com>



On 01/30/2019 01:35 PM, Ramin Farajpour Cami wrote:
> key/tmp is being kfree'd twice,once in the "aalg_desc->uinfo.auth.icv_fullbits / 8 != crypto_aead_authsize(aead)" call
> to "free_key",twice When "crypto_aead_setauthsize(aead, x->aalg->alg_trunc_len / 8)" fails call to again  "free_key",
> 
> Signed-off-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
> ---
>  net/ipv4/esp4.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
> index 5459f41fc26f..5a66e47641b0 100644
> --- a/net/ipv4/esp4.c
> +++ b/net/ipv4/esp4.c
> @@ -467,6 +467,7 @@ int esp_output_tail(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
>  
>  error_free:
>  	kfree(tmp);
> +	tmp = NULL;

Clearing tmp right before a "return err;" has no effect at all.

>  error:
>  	return err;
>  }
> @@ -959,7 +960,7 @@ static int esp_init_authenc(struct xfrm_state *x)
>  
>  free_key:
>  	kfree(key);
> -
> +	key = NULL;


Same here, this is essentially dead code.

>  error:
>  	return err;
>  }
> 

  parent reply	other threads:[~2019-01-30 23:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 21:35 [PATCH] net: esp4: Fix double free on esp4 functions Ramin Farajpour Cami
2019-01-30 21:53 ` David Miller
2019-01-30 23:07 ` Eric Dumazet [this message]
     [not found]   ` <CAKEzZ8zyhvJ1Fr6UDOxVqBnUz73xPSLwfnoM4FFGf6wHSTU=Jg@mail.gmail.com>
2019-01-31  7:27     ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38d987a0-7cc4-1565-00d4-22fdd04d7894@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=ramin.blackhat@gmail.com \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox