aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-17 07:53:38 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-17 18:38:19 -0500
commit145a36217adf91cdc6922c5b9cc985b87f8e0c73 (patch)
tree6e883bf7f8fb1fcebc58c8385e9396232abcf796 /net/ipv6/route.c
parentc440f1609b6516029ac5286e00fb86b3a11acd8e (diff)
ipv6: Do not depend on rt->n in rt6_check_neigh().
CC: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2839381116ea..c7bcd777db23 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -546,20 +546,24 @@ static inline bool rt6_check_neigh(struct rt6_info *rt)
546 struct neighbour *neigh; 546 struct neighbour *neigh;
547 bool ret = false; 547 bool ret = false;
548 548
549 neigh = rt->n;
550 if (rt->rt6i_flags & RTF_NONEXTHOP || 549 if (rt->rt6i_flags & RTF_NONEXTHOP ||
551 !(rt->rt6i_flags & RTF_GATEWAY)) 550 !(rt->rt6i_flags & RTF_GATEWAY))
552 ret = true; 551 return true;
553 else if (neigh) { 552
554 read_lock_bh(&neigh->lock); 553 rcu_read_lock_bh();
554 neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway);
555 if (neigh) {
556 read_lock(&neigh->lock);
555 if (neigh->nud_state & NUD_VALID) 557 if (neigh->nud_state & NUD_VALID)
556 ret = true; 558 ret = true;
557#ifdef CONFIG_IPV6_ROUTER_PREF 559#ifdef CONFIG_IPV6_ROUTER_PREF
558 else if (!(neigh->nud_state & NUD_FAILED)) 560 else if (!(neigh->nud_state & NUD_FAILED))
559 ret = true; 561 ret = true;
560#endif 562#endif
561 read_unlock_bh(&neigh->lock); 563 read_unlock(&neigh->lock);
562 } 564 }
565 rcu_read_unlock_bh();
566
563 return ret; 567 return ret;
564} 568}
565 569