summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-17 12:53:38 +0000
committerDavid S. Miller <davem@davemloft.net>2013-01-17 18:38:19 -0500
commit145a36217adf91cdc6922c5b9cc985b87f8e0c73 (patch)
tree6e883bf7f8fb1fcebc58c8385e9396232abcf796 /net
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')
-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)
struct neighbour *neigh;
bool ret = false;
- neigh = rt->n;
if (rt->rt6i_flags & RTF_NONEXTHOP ||
!(rt->rt6i_flags & RTF_GATEWAY))
- ret = true;
- else if (neigh) {
- read_lock_bh(&neigh->lock);
+ return true;
+
+ rcu_read_lock_bh();
+ neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway);
+ if (neigh) {
+ read_lock(&neigh->lock);
if (neigh->nud_state & NUD_VALID)
ret = true;
#ifdef CONFIG_IPV6_ROUTER_PREF
else if (!(neigh->nud_state & NUD_FAILED))
ret = true;
#endif
- read_unlock_bh(&neigh->lock);
+ read_unlock(&neigh->lock);
}
+ rcu_read_unlock_bh();
+
return ret;
}