linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: Pekka Savola <pekkas@netcore.fi>
Cc: "Maciej 'Agaran' Pijanka" <agaran@agaran.6bone.pl>,
	NetDevel List <netdev@oss.sgi.com>, <kuznet@ms2.inr.ac.ru>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] (was Re: 2.4.4 & IPv6 oopses)
Date: Fri, 4 May 2001 18:46:12 -0700 (PDT)	[thread overview]
Message-ID: <15091.23396.515412.928664@pizda.ninka.net> (raw)
In-Reply-To: <Pine.LNX.4.33.0105041709450.31252-100000@netcore.fi>
In-Reply-To: <Pine.LNX.4.21.0105041357150.17065-100000@kepler.agaran.6bone.pl> <Pine.LNX.4.33.0105041709450.31252-100000@netcore.fi>


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);
 





       reply	other threads:[~2001-05-05  1:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.33.0105041709450.31252-100000@netcore.fi>
     [not found] ` <Pine.LNX.4.21.0105041357150.17065-100000@kepler.agaran.6bone.pl>
2001-05-05  1:46   ` David S. Miller [this message]
2001-05-05  6:32     ` [PATCH] (was Re: 2.4.4 & IPv6 oopses) Cliff Albert

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=15091.23396.515412.928664@pizda.ninka.net \
    --to=davem@redhat.com \
    --cc=agaran@agaran.6bone.pl \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=pekkas@netcore.fi \
    /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).