stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Teco Boot <teco@inf-net.nl>,
	YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>,
	David Lamparter <equinox@diac24.net>,
	boutier@pps.univ-paris-diderot.fr,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: [ 06/19] ipv6: dont stop backtracking in fib6_lookup_1 if subtree does not match
Date: Thu, 12 Sep 2013 10:26:15 -0700	[thread overview]
Message-ID: <20130912172524.859702744@linuxfoundation.org> (raw)
In-Reply-To: <20130912172524.135620246@linuxfoundation.org>

3.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hannes Frederic Sowa <hannes@stressinduktion.org>

[ Upstream commit 3e3be275851bc6fc90bfdcd732cd95563acd982b ]

In case a subtree did not match we currently stop backtracking and return
NULL (root table from fib_lookup). This could yield in invalid routing
table lookups when using subtrees.

Instead continue to backtrack until a valid subtree or node is found
and return this match.

Also remove unneeded NULL check.

Reported-by: Teco Boot <teco@inf-net.nl>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: David Lamparter <equinox@diac24.net>
Cc: <boutier@pps.univ-paris-diderot.fr>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv6/ip6_fib.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -866,14 +866,22 @@ static struct fib6_node * fib6_lookup_1(
 
 			if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) {
 #ifdef CONFIG_IPV6_SUBTREES
-				if (fn->subtree)
-					fn = fib6_lookup_1(fn->subtree, args + 1);
+				if (fn->subtree) {
+					struct fib6_node *sfn;
+					sfn = fib6_lookup_1(fn->subtree,
+							    args + 1);
+					if (!sfn)
+						goto backtrack;
+					fn = sfn;
+				}
 #endif
-				if (!fn || fn->fn_flags & RTN_RTINFO)
+				if (fn->fn_flags & RTN_RTINFO)
 					return fn;
 			}
 		}
-
+#ifdef CONFIG_IPV6_SUBTREES
+backtrack:
+#endif
 		if (fn->fn_flags & RTN_ROOT)
 			break;
 



  parent reply	other threads:[~2013-09-12 17:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 17:26 [ 00/19] 3.0.96-stable review Greg Kroah-Hartman
2013-09-12 17:26 ` [ 01/19] htb: fix sign extension bug Greg Kroah-Hartman
2013-09-12 17:26 ` [ 02/19] net: check net.core.somaxconn sysctl values Greg Kroah-Hartman
2013-09-12 17:26 ` [ 03/19] fib_trie: remove potential out of bound access Greg Kroah-Hartman
2013-09-12 17:26 ` [ 04/19] tcp: cubic: fix overflow error in bictcp_update() Greg Kroah-Hartman
2013-09-12 17:26 ` [ 05/19] tcp: cubic: fix bug in bictcp_acked() Greg Kroah-Hartman
2013-09-12 17:26 ` Greg Kroah-Hartman [this message]
2013-09-12 17:26 ` [ 07/19] tun: signedness bug in tun_get_user() Greg Kroah-Hartman
2013-09-12 17:26 ` [ 08/19] ipv6: remove max_addresses check from ipv6_create_tempaddr Greg Kroah-Hartman
2013-09-12 17:26 ` [ 09/19] ipv6: drop packets with multiple fragmentation headers Greg Kroah-Hartman
2013-09-12 17:26 ` [ 10/19] ipv6: Dont depend on per socket memory for neighbour discovery messages Greg Kroah-Hartman
2013-09-12 17:26 ` [ 11/19] net: bridge: convert MLDv2 Query MRC into msecs_to_jiffies for max_delay Greg Kroah-Hartman
2013-09-12 17:26 ` [ 12/19] ICMPv6: treat dest unreachable codes 5 and 6 as EACCES, not EPROTO Greg Kroah-Hartman
2013-09-12 17:26 ` [ 13/19] tipc: fix lockdep warning during bearer initialization Greg Kroah-Hartman
2013-09-12 17:26 ` [ 14/19] PARISC: include <linux/prefetch.h> in drivers/parisc/iommu-helpers.h Greg Kroah-Hartman
2013-09-12 17:26 ` [ 15/19] pci: frv architecture needs generic setup-bus infrastructure Greg Kroah-Hartman
2013-09-12 17:26 ` [ 16/19] m32r: consistently use "suffix-$(...)" Greg Kroah-Hartman
2013-09-12 17:26 ` [ 17/19] m32r: add memcpy() for CONFIG_KERNEL_GZIP=y Greg Kroah-Hartman
2013-09-12 17:26 ` [ 18/19] m32r: make memset() global for CONFIG_KERNEL_BZIP2=y Greg Kroah-Hartman
2013-09-12 17:26 ` [ 19/19] KVM: s390: move kvm_guest_enter,exit closer to sie Greg Kroah-Hartman
2013-09-12 22:29 ` [ 00/19] 3.0.96-stable review Guenter Roeck
2013-09-12 23:07   ` Greg Kroah-Hartman
2013-09-13 23:04 ` Shuah Khan

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=20130912172524.859702744@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=boutier@pps.univ-paris-diderot.fr \
    --cc=davem@davemloft.net \
    --cc=equinox@diac24.net \
    --cc=hannes@stressinduktion.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=teco@inf-net.nl \
    --cc=yoshfuji@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).