netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv6: Fix __ip6_route_redirect
@ 2015-01-21  3:16 Martin KaFai Lau
  2015-01-26  6:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Martin KaFai Lau @ 2015-01-21  3:16 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Hannes Frederic Sowa, kernel-team

In my last commit (a3c00e4: ipv6: Remove BACKTRACK macro), the changes in
__ip6_route_redirect is incorrect.  The following case is missed:
1. The for loop tries to find a valid gateway rt. If it fails to find
   one, rt will be NULL.
2. When rt is NULL, it is set to the ip6_null_entry.
3. The newly added 'else if', from a3c00e4, will stop the backtrack from
   happening.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
 net/ipv6/route.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 166e33b..49596535 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1242,12 +1242,16 @@ restart:
 		rt = net->ipv6.ip6_null_entry;
 	else if (rt->dst.error) {
 		rt = net->ipv6.ip6_null_entry;
-	} else if (rt == net->ipv6.ip6_null_entry) {
+		goto out;
+	}
+
+	if (rt == net->ipv6.ip6_null_entry) {
 		fn = fib6_backtrack(fn, &fl6->saddr);
 		if (fn)
 			goto restart;
 	}
 
+out:
 	dst_hold(&rt->dst);
 
 	read_unlock_bh(&table->tb6_lock);
-- 
1.8.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] ipv6: Fix __ip6_route_redirect
  2015-01-21  3:16 [PATCH net] ipv6: Fix __ip6_route_redirect Martin KaFai Lau
@ 2015-01-26  6:10 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-26  6:10 UTC (permalink / raw)
  To: kafai; +Cc: netdev, hannes, kernel-team

From: Martin KaFai Lau <kafai@fb.com>
Date: Tue, 20 Jan 2015 19:16:02 -0800

> In my last commit (a3c00e4: ipv6: Remove BACKTRACK macro), the changes in
> __ip6_route_redirect is incorrect.  The following case is missed:
> 1. The for loop tries to find a valid gateway rt. If it fails to find
>    one, rt will be NULL.
> 2. When rt is NULL, it is set to the ip6_null_entry.
> 3. The newly added 'else if', from a3c00e4, will stop the backtrack from
>    happening.
> 
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>

Applied and queued up for -stable, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-26  6:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-21  3:16 [PATCH net] ipv6: Fix __ip6_route_redirect Martin KaFai Lau
2015-01-26  6:10 ` David Miller

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