* [PATCH] (was Re: 2.4.4 & IPv6 oopses)
[not found] ` <Pine.LNX.4.33.0105041709450.31252-100000@netcore.fi>
@ 2001-05-05 1:46 ` David S. Miller
2001-05-05 6:32 ` Cliff Albert
0 siblings, 1 reply; 2+ messages in thread
From: David S. Miller @ 2001-05-05 1:46 UTC (permalink / raw)
To: Pekka Savola
Cc: Maciej 'Agaran' Pijanka, NetDevel List, kuznet,
linux-kernel
Pekka Savola writes:
> struct in6_addr *saddr = NULL;
> [...]
> if (skb && ipv6_chk_addr(&skb->nh.ipv6h->saddr, dev))
> saddr = &skb->nh.ipv6h->saddr;
> [...]
> ndisc_send_ns(dev, neigh, target, target, saddr);
> [...]
> This check apparently fails? and saddr is left null.
Yes, it can fail, and this is normal. The problem is in
ndisc_send_ns().
> in ndisc_send_ns, NULL saddr is checked:
>
> send_llinfo = dev->addr_len && ipv6_addr_type(saddr) != IPV6_ADDR_ANY;
>
> which make a null ptr dereference. send_llinfo check was added recently
> to fix RFC incompliancy a week or so ago.
A few lines later we setup saddr properly if it is NULL, what we need
to do is either:
1) Move that "if (saddr == NULL)" code block up above the send_llinfo
check.
I think this would break the thing the send_llinfo check
was meant to fix, but I can't be sure.
2) Just check for NULL saddr in the send_llinfo check and if NULL
then send_llinfo is set to zero.
For now, I've put solution #2 into my tree, patch attached below.
--- linux/net/ipv6/ndisc.c.~1~ Thu May 3 00:01:10 2001
+++ linux/net/ipv6/ndisc.c Fri May 4 18:44:54 2001
@@ -382,7 +382,7 @@
int send_llinfo;
len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
- send_llinfo = dev->addr_len && ipv6_addr_type(saddr) != IPV6_ADDR_ANY;
+ send_llinfo = dev->addr_len && saddr && ipv6_addr_type(saddr) != IPV6_ADDR_ANY;
if (send_llinfo)
len += NDISC_OPT_SPACE(dev->addr_len);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] (was Re: 2.4.4 & IPv6 oopses)
2001-05-05 1:46 ` [PATCH] (was Re: 2.4.4 & IPv6 oopses) David S. Miller
@ 2001-05-05 6:32 ` Cliff Albert
0 siblings, 0 replies; 2+ messages in thread
From: Cliff Albert @ 2001-05-05 6:32 UTC (permalink / raw)
To: David S. Miller; +Cc: linux-kernel
On Fri, May 04, 2001 at 06:46:12PM -0700, David S. Miller wrote:
> Pekka Savola writes:
> > struct in6_addr *saddr = NULL;
> > [...]
> > if (skb && ipv6_chk_addr(&skb->nh.ipv6h->saddr, dev))
> > saddr = &skb->nh.ipv6h->saddr;
> > [...]
> > ndisc_send_ns(dev, neigh, target, target, saddr);
> > [...]
> > This check apparently fails? and saddr is left null.
>
> Yes, it can fail, and this is normal. The problem is in
> ndisc_send_ns().
>
> > in ndisc_send_ns, NULL saddr is checked:
> >
> > send_llinfo = dev->addr_len && ipv6_addr_type(saddr) != IPV6_ADDR_ANY;
> >
> > which make a null ptr dereference. send_llinfo check was added recently
> > to fix RFC incompliancy a week or so ago.
>
> A few lines later we setup saddr properly if it is NULL, what we need
> to do is either:
>
> 1) Move that "if (saddr == NULL)" code block up above the send_llinfo
> check.
>
> I think this would break the thing the send_llinfo check
> was meant to fix, but I can't be sure.
>
> 2) Just check for NULL saddr in the send_llinfo check and if NULL
> then send_llinfo is set to zero.
>
> For now, I've put solution #2 into my tree, patch attached below.
>
> --- linux/net/ipv6/ndisc.c.~1~ Thu May 3 00:01:10 2001
> +++ linux/net/ipv6/ndisc.c Fri May 4 18:44:54 2001
> @@ -382,7 +382,7 @@
> int send_llinfo;
>
> len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
> - send_llinfo = dev->addr_len && ipv6_addr_type(saddr) != IPV6_ADDR_ANY;
> + send_llinfo = dev->addr_len && saddr && ipv6_addr_type(saddr) != IPV6_ADDR_ANY;
> if (send_llinfo)
> len += NDISC_OPT_SPACE(dev->addr_len);
>
This patch fixed ALL my ICMPv6 related problems. Thanks!
--
Cliff Albert | IRCNet: #linux.nl, #ne2000, #linux, #freebsd.nl
cliff@oisec.net | #openbsd, #ipv6, #cu2.nl
-[ICQ: 18461740]--------| 6BONE: CA2-6BONE RIPE: CA3348-RIPE
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-05-05 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Pine.LNX.4.21.0105041357150.17065-100000@kepler.agaran.6bone.pl>
[not found] ` <Pine.LNX.4.33.0105041709450.31252-100000@netcore.fi>
2001-05-05 1:46 ` [PATCH] (was Re: 2.4.4 & IPv6 oopses) David S. Miller
2001-05-05 6:32 ` Cliff Albert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox