From: Alexey Dobriyan <adobriyan@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] ipcomp: double free at ipcomp_destroy()
Date: Mon, 15 Feb 2010 19:28:10 +0200 [thread overview]
Message-ID: <20100215172810.GC4905@x200> (raw)
In-Reply-To: <20100215081052.GA18516@gondor.apana.org.au>
On Mon, Feb 15, 2010 at 04:10:52PM +0800, Herbert Xu wrote:
> On Mon, Feb 15, 2010 at 04:08:46PM +0800, Herbert Xu wrote:
> >
> > How about just getting rid of the ipcomp_destroy call in ipcomp's
> > init_state functions? Calling the destructor twice is a bit iffy
> > even if we can make it work by setting various things to NULL and
> > testing for it.
>
> Something like this (totally untested):
OK, it survives beating here.
> --- a/net/ipv4/ipcomp.c
> +++ b/net/ipv4/ipcomp.c
> @@ -124,16 +124,12 @@ static int ipcomp4_init_state(struct xfrm_state *x)
> if (x->props.mode == XFRM_MODE_TUNNEL) {
> err = ipcomp_tunnel_attach(x);
> if (err)
> - goto error_tunnel;
> + goto out;
> }
>
> err = 0;
> out:
> return err;
> -
> -error_tunnel:
> - ipcomp_destroy(x);
> - goto out;
> }
>
> static const struct xfrm_type ipcomp_type = {
> diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
> index 2f2a5ca..002e6ee 100644
> --- a/net/ipv6/ipcomp6.c
> +++ b/net/ipv6/ipcomp6.c
> @@ -154,16 +154,12 @@ static int ipcomp6_init_state(struct xfrm_state *x)
> if (x->props.mode == XFRM_MODE_TUNNEL) {
> err = ipcomp6_tunnel_attach(x);
> if (err)
> - goto error_tunnel;
> + goto out;
> }
>
> err = 0;
> out:
> return err;
> -error_tunnel:
> - ipcomp_destroy(x);
> -
> - goto out;
> }
>
> static const struct xfrm_type ipcomp6_type =
>
> Cheers,
> --
> Visit Openswan at http://www.openswan.org/
> Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2010-02-15 17:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-14 14:44 [PATCH] ipcomp: double free at ipcomp_destroy() Alexey Dobriyan
2010-02-15 0:18 ` Herbert Xu
2010-02-15 7:32 ` Alexey Dobriyan
2010-02-15 8:08 ` Herbert Xu
2010-02-15 8:10 ` Herbert Xu
2010-02-15 15:50 ` Alexey Dobriyan
2010-02-16 5:29 ` Herbert Xu
2010-02-15 17:28 ` Alexey Dobriyan [this message]
2010-02-16 5:24 ` Herbert Xu
2010-02-16 23:14 ` David Miller
2010-02-16 6:00 ` Herbert Xu
2010-02-16 23:14 ` David Miller
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=20100215172810.GC4905@x200 \
--to=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.