diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-04-19 09:19:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-20 21:21:16 -0400 |
commit | bc8a36942a5c05896d373a8e98d5e6b14514b4bc (patch) | |
tree | 178bddda37da663a4bcc4dd57bf68f53b6b8a4bf /net/sysctl_net.c | |
parent | ab41a2ca50d27ee2dc8b9eef07aeb251168271be (diff) |
net sysctl: Register an empty /proc/sys/net
Implementation limitations of the sysctl core won't let /proc/sys/net
reside in a network namespace. /proc/sys/net at least must be registered
as a normal sysctl. So register /proc/sys/net early as an empty directory
to guarantee we don't violate this constraint and hit bugs in the sysctl
implementation.
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>
Diffstat (limited to 'net/sysctl_net.c')
-rw-r--r-- | net/sysctl_net.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index 3865c4f76b82..2b2986dd04ae 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -88,9 +88,18 @@ static struct pernet_operations sysctl_pernet_ops = { | |||
88 | .exit = sysctl_net_exit, | 88 | .exit = sysctl_net_exit, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static struct ctl_table_header *net_header; | ||
91 | static __init int net_sysctl_init(void) | 92 | static __init int net_sysctl_init(void) |
92 | { | 93 | { |
93 | int ret; | 94 | static struct ctl_table empty[1]; |
95 | int ret = -ENOMEM; | ||
96 | /* Avoid limitations in the sysctl implementation by | ||
97 | * registering "/proc/sys/net" as an empty directory not in a | ||
98 | * network namespace. | ||
99 | */ | ||
100 | net_header = register_sysctl("net", empty); | ||
101 | if (!net_header) | ||
102 | goto out; | ||
94 | ret = register_pernet_subsys(&sysctl_pernet_ops); | 103 | ret = register_pernet_subsys(&sysctl_pernet_ops); |
95 | if (ret) | 104 | if (ret) |
96 | goto out; | 105 | goto out; |