diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-10-07 17:12:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-07 17:12:10 -0400 |
commit | 68fffc679694d5f7c02fdeb684b481416cd8213b (patch) | |
tree | 63afbb6666c361af8a5480d206c170dd5610c646 /net/ipv6 | |
parent | 23542618deb77cfed312842fe8c41ed19fb16470 (diff) |
ipv6: clean up ip6_route_net_init() error handling
ip6_route_net_init() error handling looked less than solid, fix 'er up.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/route.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f4385a6569c2..635d97d54b0a 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2631,10 +2631,8 @@ static int ip6_route_net_init(struct net *net) | |||
2631 | net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, | 2631 | net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, |
2632 | sizeof(*net->ipv6.ip6_prohibit_entry), | 2632 | sizeof(*net->ipv6.ip6_prohibit_entry), |
2633 | GFP_KERNEL); | 2633 | GFP_KERNEL); |
2634 | if (!net->ipv6.ip6_prohibit_entry) { | 2634 | if (!net->ipv6.ip6_prohibit_entry) |
2635 | kfree(net->ipv6.ip6_null_entry); | 2635 | goto out_ip6_null_entry; |
2636 | goto out; | ||
2637 | } | ||
2638 | net->ipv6.ip6_prohibit_entry->u.dst.path = | 2636 | net->ipv6.ip6_prohibit_entry->u.dst.path = |
2639 | (struct dst_entry *)net->ipv6.ip6_prohibit_entry; | 2637 | (struct dst_entry *)net->ipv6.ip6_prohibit_entry; |
2640 | net->ipv6.ip6_prohibit_entry->u.dst.ops = net->ipv6.ip6_dst_ops; | 2638 | net->ipv6.ip6_prohibit_entry->u.dst.ops = net->ipv6.ip6_dst_ops; |
@@ -2642,11 +2640,8 @@ static int ip6_route_net_init(struct net *net) | |||
2642 | net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, | 2640 | net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, |
2643 | sizeof(*net->ipv6.ip6_blk_hole_entry), | 2641 | sizeof(*net->ipv6.ip6_blk_hole_entry), |
2644 | GFP_KERNEL); | 2642 | GFP_KERNEL); |
2645 | if (!net->ipv6.ip6_blk_hole_entry) { | 2643 | if (!net->ipv6.ip6_blk_hole_entry) |
2646 | kfree(net->ipv6.ip6_null_entry); | 2644 | goto out_ip6_prohibit_entry; |
2647 | kfree(net->ipv6.ip6_prohibit_entry); | ||
2648 | goto out; | ||
2649 | } | ||
2650 | net->ipv6.ip6_blk_hole_entry->u.dst.path = | 2645 | net->ipv6.ip6_blk_hole_entry->u.dst.path = |
2651 | (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; | 2646 | (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; |
2652 | net->ipv6.ip6_blk_hole_entry->u.dst.ops = net->ipv6.ip6_dst_ops; | 2647 | net->ipv6.ip6_blk_hole_entry->u.dst.ops = net->ipv6.ip6_dst_ops; |
@@ -2662,6 +2657,12 @@ static int ip6_route_net_init(struct net *net) | |||
2662 | out: | 2657 | out: |
2663 | return ret; | 2658 | return ret; |
2664 | 2659 | ||
2660 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
2661 | out_ip6_prohibit_entry: | ||
2662 | kfree(net->ipv6.ip6_prohibit_entry); | ||
2663 | out_ip6_null_entry: | ||
2664 | kfree(net->ipv6.ip6_null_entry); | ||
2665 | #endif | ||
2665 | out_ip6_dst_ops: | 2666 | out_ip6_dst_ops: |
2666 | release_net(net->ipv6.ip6_dst_ops->dst_net); | 2667 | release_net(net->ipv6.ip6_dst_ops->dst_net); |
2667 | kfree(net->ipv6.ip6_dst_ops); | 2668 | kfree(net->ipv6.ip6_dst_ops); |