diff options
-rw-r--r-- | fs/proc/proc_sysctl.c | 3 | ||||
-rw-r--r-- | include/linux/sysctl.h | 1 | ||||
-rw-r--r-- | kernel/sysctl.c | 13 | ||||
-rw-r--r-- | net/sysctl_net.c | 4 |
4 files changed, 9 insertions, 12 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index d82f4a8b4b8..9d29d28af57 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -468,5 +468,6 @@ int __init proc_sys_init(void) | |||
468 | proc_sys_root->proc_iops = &proc_sys_dir_operations; | 468 | proc_sys_root->proc_iops = &proc_sys_dir_operations; |
469 | proc_sys_root->proc_fops = &proc_sys_dir_file_operations; | 469 | proc_sys_root->proc_fops = &proc_sys_dir_file_operations; |
470 | proc_sys_root->nlink = 0; | 470 | proc_sys_root->nlink = 0; |
471 | return 0; | 471 | |
472 | return sysctl_init(); | ||
472 | } | 473 | } |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index cf3ee7f246d..5e3532e9599 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -1095,6 +1095,7 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, | |||
1095 | void unregister_sysctl_table(struct ctl_table_header * table); | 1095 | void unregister_sysctl_table(struct ctl_table_header * table); |
1096 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); | 1096 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); |
1097 | 1097 | ||
1098 | extern int sysctl_init(void); | ||
1098 | #else /* CONFIG_SYSCTL */ | 1099 | #else /* CONFIG_SYSCTL */ |
1099 | static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) | 1100 | static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) |
1100 | { | 1101 | { |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index d5bbddd0de2..ad460248acc 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -192,7 +192,7 @@ static int sysrq_sysctl_handler(ctl_table *table, int write, | |||
192 | 192 | ||
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | static struct ctl_table root_table[]; | 195 | static struct ctl_table root_table[1]; |
196 | static struct ctl_table_root sysctl_table_root; | 196 | static struct ctl_table_root sysctl_table_root; |
197 | static struct ctl_table_header root_table_header = { | 197 | static struct ctl_table_header root_table_header = { |
198 | {{.count = 1, | 198 | {{.count = 1, |
@@ -222,7 +222,7 @@ int sysctl_legacy_va_layout; | |||
222 | 222 | ||
223 | /* The default sysctl tables: */ | 223 | /* The default sysctl tables: */ |
224 | 224 | ||
225 | static struct ctl_table root_table[] = { | 225 | static struct ctl_table sysctl_base_table[] = { |
226 | { | 226 | { |
227 | .procname = "kernel", | 227 | .procname = "kernel", |
228 | .mode = 0555, | 228 | .mode = 0555, |
@@ -1747,17 +1747,12 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table) | |||
1747 | } | 1747 | } |
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | static __init int sysctl_init(void) | 1750 | int __init sysctl_init(void) |
1751 | { | 1751 | { |
1752 | sysctl_set_parent(NULL, root_table); | 1752 | register_sysctl_table(sysctl_base_table); |
1753 | #ifdef CONFIG_SYSCTL_SYSCALL_CHECK | ||
1754 | sysctl_check_table(current->nsproxy, root_table); | ||
1755 | #endif | ||
1756 | return 0; | 1753 | return 0; |
1757 | } | 1754 | } |
1758 | 1755 | ||
1759 | core_initcall(sysctl_init); | ||
1760 | |||
1761 | static struct ctl_table *is_branch_in(struct ctl_table *branch, | 1756 | static struct ctl_table *is_branch_in(struct ctl_table *branch, |
1762 | struct ctl_table *table) | 1757 | struct ctl_table *table) |
1763 | { | 1758 | { |
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index e75813904f2..a6bbee2bc71 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -90,7 +90,7 @@ static struct pernet_operations sysctl_pernet_ops = { | |||
90 | .exit = sysctl_net_exit, | 90 | .exit = sysctl_net_exit, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static __init int sysctl_init(void) | 93 | static __init int net_sysctl_init(void) |
94 | { | 94 | { |
95 | int ret; | 95 | int ret; |
96 | ret = register_pernet_subsys(&sysctl_pernet_ops); | 96 | ret = register_pernet_subsys(&sysctl_pernet_ops); |
@@ -102,7 +102,7 @@ static __init int sysctl_init(void) | |||
102 | out: | 102 | out: |
103 | return ret; | 103 | return ret; |
104 | } | 104 | } |
105 | subsys_initcall(sysctl_init); | 105 | subsys_initcall(net_sysctl_init); |
106 | 106 | ||
107 | struct ctl_table_header *register_net_sysctl_table(struct net *net, | 107 | struct ctl_table_header *register_net_sysctl_table(struct net *net, |
108 | const struct ctl_path *path, struct ctl_table *table) | 108 | const struct ctl_path *path, struct ctl_table *table) |