summaryrefslogtreecommitdiff
path: root/net/sysctl_net.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-04-19 13:19:46 +0000
committerDavid S. Miller <davem@davemloft.net>2012-04-20 21:21:16 -0400
commitbc8a36942a5c05896d373a8e98d5e6b14514b4bc (patch)
tree178bddda37da663a4bcc4dd57bf68f53b6b8a4bf /net/sysctl_net.c
parentab41a2ca50d27ee2dc8b9eef07aeb251168271be (diff)
downloadlinux-3.10-bc8a36942a5c05896d373a8e98d5e6b14514b4bc.tar.gz
linux-3.10-bc8a36942a5c05896d373a8e98d5e6b14514b4bc.tar.bz2
linux-3.10-bc8a36942a5c05896d373a8e98d5e6b14514b4bc.zip
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.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index 3865c4f76b8..2b2986dd04a 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -88,9 +88,18 @@ static struct pernet_operations sysctl_pernet_ops = {
.exit = sysctl_net_exit,
};
+static struct ctl_table_header *net_header;
static __init int net_sysctl_init(void)
{
- int ret;
+ static struct ctl_table empty[1];
+ int ret = -ENOMEM;
+ /* Avoid limitations in the sysctl implementation by
+ * registering "/proc/sys/net" as an empty directory not in a
+ * network namespace.
+ */
+ net_header = register_sysctl("net", empty);
+ if (!net_header)
+ goto out;
ret = register_pernet_subsys(&sysctl_pernet_ops);
if (ret)
goto out;