summaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-16 00:51:55 +0200
committerDavid S. Miller <davem@davemloft.net>2012-06-16 00:51:55 +0200
commit7e52b33bd50faa866bc3e6e97e68438bc5e52251 (patch)
tree46e68adf23f4f170a0eb5045c33a76234de6cf92 /net/ipv6
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsh... (diff)
parentipv6: Prevent access to uninitialized fib_table_hash via /proc/net/ipv6_route (diff)
downloadlinux-7e52b33bd50faa866bc3e6e97e68438bc5e52251.tar.xz
linux-7e52b33bd50faa866bc3e6e97e68438bc5e52251.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: net/ipv6/route.c This deals with a merge conflict between the net-next addition of the inetpeer network namespace ops, and Thomas Graf's bug fix in 2a0c451ade8e1783c5d453948289e4a978d417c9 which makes sure we don't register /proc/net/ipv6_route before it is actually safe to do so. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_fib.c18
-rw-r--r--net/ipv6/route.c24
2 files changed, 26 insertions, 16 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 215afc74d8aa..a83bf067bdc5 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1697,21 +1697,25 @@ int __init fib6_init(void)
ret = register_pernet_subsys(&fib6_net_ops);
if (ret)
goto out_kmem_cache_create;
-
- ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib,
- NULL);
- if (ret)
- goto out_unregister_subsys;
out:
return ret;
-out_unregister_subsys:
- unregister_pernet_subsys(&fib6_net_ops);
out_kmem_cache_create:
kmem_cache_destroy(fib6_node_kmem);
goto out;
}
+int __init fib6_init_late(void)
+{
+ return __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib,
+ NULL);
+}
+
+void fib6_cleanup_late(void)
+{
+ rtnl_unregister(PF_INET6, RTM_GETROUTE);
+}
+
void fib6_gc_cleanup(void)
{
unregister_pernet_subsys(&fib6_net_ops);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0d41f68daff2..c7ccc36ba63e 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2974,13 +2974,17 @@ int __init ip6_route_init(void)
if (ret)
goto out_kmem_cache;
- ret = register_pernet_subsys(&ip6_route_net_ops);
+ ret = fib6_init();
if (ret)
goto out_dst_entries;
ret = register_pernet_subsys(&ipv6_inetpeer_ops);
if (ret)
- goto out_register_subsys;
+ goto out_fib6_init;
+
+ ret = register_pernet_subsys(&ip6_route_net_ops);
+ if (ret)
+ goto out_register_inetpeer;
ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep;
@@ -2995,13 +2999,13 @@ int __init ip6_route_init(void)
init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
#endif
- ret = fib6_init();
+ ret = fib6_init_late();
if (ret)
- goto out_register_inetpeer;
+ goto out_register_subsys;
ret = xfrm6_init();
if (ret)
- goto out_fib6_init;
+ goto out_fib6_init_late;
ret = fib6_rules_init();
if (ret)
@@ -3024,12 +3028,14 @@ fib6_rules_init:
fib6_rules_cleanup();
xfrm6_init:
xfrm6_fini();
-out_fib6_init:
- fib6_gc_cleanup();
-out_register_inetpeer:
- unregister_pernet_subsys(&ipv6_inetpeer_ops);
+out_fib6_init_late:
+ fib6_cleanup_late();
out_register_subsys:
unregister_pernet_subsys(&ip6_route_net_ops);
+out_register_inetpeer:
+ unregister_pernet_subsys(&ipv6_inetpeer_ops);
+out_fib6_init:
+ fib6_gc_cleanup();
out_dst_entries:
dst_entries_destroy(&ip6_dst_blackhole_ops);
out_kmem_cache: