aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2012-10-28 20:13:19 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-03 14:59:05 -0400
commit94e187c01512c9cf29e2ff54bf1a1b045f38293d (patch)
tree2149f4652fb0fc997ce5728f9574e1ab5351f0e5 /net/ipv6/route.c
parent6da025fa23bb10c82f80de319c837ed2b02306e4 (diff)
ipv6: introduce ip6_rt_put()
As suggested by Eric, we could introduce a helper function for ipv6 too, to avoid checking if rt is NULL before dst_release(). Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> 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, 7 insertions, 7 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 9c7b5d800495..c1cfcb7e5632 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -732,7 +732,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
732 else 732 else
733 rt6_set_expires(rt, jiffies + HZ * lifetime); 733 rt6_set_expires(rt, jiffies + HZ * lifetime);
734 734
735 dst_release(&rt->dst); 735 ip6_rt_put(rt);
736 } 736 }
737 return 0; 737 return 0;
738} 738}
@@ -948,7 +948,7 @@ restart:
948 else 948 else
949 goto out2; 949 goto out2;
950 950
951 dst_release(&rt->dst); 951 ip6_rt_put(rt);
952 rt = nrt ? : net->ipv6.ip6_null_entry; 952 rt = nrt ? : net->ipv6.ip6_null_entry;
953 953
954 dst_hold(&rt->dst); 954 dst_hold(&rt->dst);
@@ -965,7 +965,7 @@ restart:
965 * Race condition! In the gap, when table->tb6_lock was 965 * Race condition! In the gap, when table->tb6_lock was
966 * released someone could insert this route. Relookup. 966 * released someone could insert this route. Relookup.
967 */ 967 */
968 dst_release(&rt->dst); 968 ip6_rt_put(rt);
969 goto relookup; 969 goto relookup;
970 970
971out: 971out:
@@ -1576,7 +1576,7 @@ int ip6_route_add(struct fib6_config *cfg)
1576 goto out; 1576 goto out;
1577 if (dev) { 1577 if (dev) {
1578 if (dev != grt->dst.dev) { 1578 if (dev != grt->dst.dev) {
1579 dst_release(&grt->dst); 1579 ip6_rt_put(grt);
1580 goto out; 1580 goto out;
1581 } 1581 }
1582 } else { 1582 } else {
@@ -1587,7 +1587,7 @@ int ip6_route_add(struct fib6_config *cfg)
1587 } 1587 }
1588 if (!(grt->rt6i_flags & RTF_GATEWAY)) 1588 if (!(grt->rt6i_flags & RTF_GATEWAY))
1589 err = 0; 1589 err = 0;
1590 dst_release(&grt->dst); 1590 ip6_rt_put(grt);
1591 1591
1592 if (err) 1592 if (err)
1593 goto out; 1593 goto out;
@@ -1673,7 +1673,7 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info)
1673 write_unlock_bh(&table->tb6_lock); 1673 write_unlock_bh(&table->tb6_lock);
1674 1674
1675out: 1675out:
1676 dst_release(&rt->dst); 1676 ip6_rt_put(rt);
1677 return err; 1677 return err;
1678} 1678}
1679 1679
@@ -2732,7 +2732,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2732 2732
2733 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); 2733 skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
2734 if (!skb) { 2734 if (!skb) {
2735 dst_release(&rt->dst); 2735 ip6_rt_put(rt);
2736 err = -ENOBUFS; 2736 err = -ENOBUFS;
2737 goto errout; 2737 goto errout;
2738 } 2738 }