aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-01-27 18:07:56 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-27 21:00:08 -0500
commiteb857186eb771998fc9ab4bfd398a6fedb5a295c (patch)
treee3cde1845c4672b8123b34b631133f28194873a7 /net/ipv6/ndisc.c
parent0ec88662041e172acf33d7a15a2020841ee82afb (diff)
ipv6: ndisc: Convert to dst_neigh_lookup()
Now all code paths grab a local reference to the neigh, so if neigh is not NULL we unconditionally release it at the end. The old logic would only release if we didn't have a non-NULL 'rt'. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d8f02ef88e59..c574ebce3fb5 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1223,11 +1223,17 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1223 1223
1224 rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev); 1224 rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev);
1225 1225
1226 if (rt) 1226 if (rt) {
1227 neigh = dst_get_neighbour_noref(&rt->dst); 1227 neigh = dst_neigh_lookup(&rt->dst, &ipv6_hdr(skb)->saddr);
1228 1228 if (!neigh) {
1229 ND_PRINTK0(KERN_ERR
1230 "ICMPv6 RA: %s() got default router without neighbour.\n",
1231 __func__);
1232 dst_release(&rt->dst);
1233 return;
1234 }
1235 }
1229 if (rt && lifetime == 0) { 1236 if (rt && lifetime == 0) {
1230 neigh_clone(neigh);
1231 ip6_del_rt(rt); 1237 ip6_del_rt(rt);
1232 rt = NULL; 1238 rt = NULL;
1233 } 1239 }
@@ -1244,7 +1250,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1244 return; 1250 return;
1245 } 1251 }
1246 1252
1247 neigh = dst_get_neighbour_noref(&rt->dst); 1253 neigh = dst_neigh_lookup(&rt->dst, &ipv6_hdr(skb)->saddr);
1248 if (neigh == NULL) { 1254 if (neigh == NULL) {
1249 ND_PRINTK0(KERN_ERR 1255 ND_PRINTK0(KERN_ERR
1250 "ICMPv6 RA: %s() got default router without neighbour.\n", 1256 "ICMPv6 RA: %s() got default router without neighbour.\n",
@@ -1411,7 +1417,7 @@ skip_routeinfo:
1411out: 1417out:
1412 if (rt) 1418 if (rt)
1413 dst_release(&rt->dst); 1419 dst_release(&rt->dst);
1414 else if (neigh) 1420 if (neigh)
1415 neigh_release(neigh); 1421 neigh_release(neigh);
1416} 1422}
1417 1423