summaryrefslogtreecommitdiffstats
path: root/net/ipv6/icmp.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-11-16 04:02:59 +0100
committerDavid S. Miller <davem@davemloft.net>2012-11-19 02:30:55 +0100
commit464dc801c76aa0db88e16e8f5f47c6879858b9b2 (patch)
treecfaf0f43f4ce50669f07031ec42062b4c9a7f985 /net/ipv6/icmp.c
parentsysctl: Pass useful parameters to sysctl permissions (diff)
downloadlinux-464dc801c76aa0db88e16e8f5f47c6879858b9b2.tar.xz
linux-464dc801c76aa0db88e16e8f5f47c6879858b9b2.zip
net: Don't export sysctls to unprivileged users
In preparation for supporting the creation of network namespaces by unprivileged users, modify all of the per net sysctl exports and refuse to allow them to unprivileged users. This makes it safe for unprivileged users in general to access per net sysctls, and allows sysctls to be exported to unprivileged users on an individual basis as they are deemed safe. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r--net/ipv6/icmp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index b4a9fd51dae7..d77dc1e2a42b 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -967,9 +967,14 @@ struct ctl_table * __net_init ipv6_icmp_sysctl_init(struct net *net)
sizeof(ipv6_icmp_table_template),
GFP_KERNEL);
- if (table)
+ if (table) {
table[0].data = &net->ipv6.sysctl.icmpv6_time;
+ /* Don't export sysctls to unprivileged users */
+ if (net->user_ns != &init_user_ns)
+ table[0].procname = NULL;
+ }
+
return table;
}
#endif