From: Kazunori MIYAZAWA <kazunori@miyazawa.org>
To: David Miller <davem@davemloft.net>
Cc: miika@iki.fi, Diego.Beltrami@hiit.fi,
herbert@gondor.apana.org.au, netdev@vger.kernel.org,
usagi-core@linux-ipv6.org
Subject: Re: [PATCH][IPSEC][4/7] inter address family ipsec tunnel
Date: Fri, 01 Dec 2006 13:41:39 +0900 [thread overview]
Message-ID: <456FB283.9090904@miyazawa.org> (raw)
In-Reply-To: <20061130.164827.57154936.davem@davemloft.net>
David Miller wrote:
> From: Kazunori MIYAZAWA <kazunori@miyazawa.org>
> Date: Fri, 24 Nov 2006 14:38:39 +0900
>
> What is going on here?
>
>> + /* Without this, the atomic inc below segfaults */
>> + if (encap_family == AF_INET6) {
>> + rt->peer = NULL;
>> + rt_bind_peer(rt,1);
>> + }
> ...
>> - dst_prev->output = xfrm4_output;
>> + if (dst_prev->xfrm->props.family == AF_INET)
>> + dst_prev->output = xfrm4_output;
>> +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
>> + else
>> + dst_prev->output = xfrm6_output;
>> +#endif
>> if (rt->peer)
>> atomic_inc(&rt->peer->refcnt);
>
> If it's non-NULL and you get a segfault for atomic_inc() that
> means there is garbage here, and it seems that if you're
> setting it to NULL explicitly then it's just a workaround
> for whatever problem is causing it to be non-NULL to begin
> with.
>
> What is putting a non-valid pointer value there? Is this an IPV6 or
> IPSEC dst route by chance? If so, that makes this change really
> wrong, and we are corrupting the route by running rt_bind_peer() on
> it. rt_bind_peer() is only valid on ipv4 route entries.
Thank you for your good catch.
I think atomic_inc must be done in case of props.family == AF_INET.
And we probably should manage reference count of the device in case of
AF_INET6.
Anyway I'll check and fix it.
Thank you.
--
Kazunori Miyazawa
next prev parent reply other threads:[~2006-12-01 4:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-24 5:38 [PATCH][IPSEC][4/7] inter address family ipsec tunnel Kazunori MIYAZAWA
2006-12-01 0:48 ` David Miller
2006-12-01 4:41 ` Kazunori MIYAZAWA [this message]
2006-12-06 11:35 ` Kazunori MIYAZAWA
2006-12-07 7:37 ` David Miller
2006-12-07 7:40 ` David Miller
2006-12-07 7:48 ` David Miller
2006-12-07 11:23 ` Kazunori MIYAZAWA
2006-12-07 22:03 ` 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=456FB283.9090904@miyazawa.org \
--to=kazunori@miyazawa.org \
--cc=Diego.Beltrami@hiit.fi \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=miika@iki.fi \
--cc=netdev@vger.kernel.org \
--cc=usagi-core@linux-ipv6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).