]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
net sysctl: Initialize the network sysctls sooner to avoid problems.
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 19 Apr 2012 13:20:32 +0000 (13:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Apr 2012 01:21:16 +0000 (21:21 -0400)
If the netfilter code is modified to use register_net_sysctl_table the
kernel fails to boot because the per net sysctl infrasturce is not setup
soon enough.  So to avoid races call net_sysctl_init from sock_init().

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/net_namespace.h
net/socket.c
net/sysctl_net.c

index 446245e3adea65b89b81ff068f16d9204c6d46c3..767dcd401e574dfc8b51fa8b200d87982123e33d 100644 (file)
@@ -283,6 +283,11 @@ struct ctl_path;
 struct ctl_table;
 struct ctl_table_header;
 
+#ifdef CONFIG_SYSCTL
+extern int net_sysctl_init(void);
+#else
+static inline int net_sysctl_init(void) { return 0; }
+#endif
 extern struct ctl_table_header *register_net_sysctl_table(struct net *net,
        const struct ctl_path *path, struct ctl_table *table);
 extern struct ctl_table_header *register_net_sysctl_rotable(
index d6c1af9ae7b203745c32411a4d87dcee23b48c80..e34510928dcc09df70491584655a5c6f9130acc5 100644 (file)
@@ -2524,6 +2524,12 @@ EXPORT_SYMBOL(sock_unregister);
 static int __init sock_init(void)
 {
        int err;
+       /*
+        *      Initialize the network sysctl infrastructure.
+        */
+       err = net_sysctl_init();
+       if (err)
+               goto out;
 
        /*
         *      Initialize sock SLAB cache.
index 2b2986dd04ae7d109848ee52f3a06b6270c78d10..ce97237b653f35a1380fe8432bdfa3df6535d60e 100644 (file)
@@ -89,7 +89,7 @@ static struct pernet_operations sysctl_pernet_ops = {
 };
 
 static struct ctl_table_header *net_header;
-static __init int net_sysctl_init(void)
+__init int net_sysctl_init(void)
 {
        static struct ctl_table empty[1];
        int ret = -ENOMEM;
@@ -109,7 +109,6 @@ static __init int net_sysctl_init(void)
 out:
        return ret;
 }
-subsys_initcall(net_sysctl_init);
 
 struct ctl_table_header *register_net_sysctl_table(struct net *net,
        const struct ctl_path *path, struct ctl_table *table)