Skip to content

Commit

Permalink
net sysctl: Register an empty /proc/sys/net
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Apr 21, 2012
1 parent ab41a2c commit bc8a369
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion net/sysctl_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bc8a369

Please sign in to comment.