diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/neighbour.c | 4 | ||||
-rw-r--r-- | net/core/sysctl_net_core.c | 5 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 8 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 4 | ||||
-rw-r--r-- | net/ipv4/route.c | 4 | ||||
-rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 3 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 4 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 7 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 4 | ||||
-rw-r--r-- | net/ipv6/route.c | 4 | ||||
-rw-r--r-- | net/ipv6/sysctl_net_ipv6.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblc.c | 7 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblcr.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_acct.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_ecache.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_helper.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_dccp.c | 8 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_standalone.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_timestamp.c | 4 | ||||
-rw-r--r-- | net/unix/sysctl_net_unix.c | 4 | ||||
-rw-r--r-- | net/xfrm/xfrm_sysctl.c | 4 |
22 files changed, 98 insertions, 4 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 22571488730a..f1c0c2e9cad5 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2987,6 +2987,10 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | |||
2987 | t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].extra1 = dev; | 2987 | t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].extra1 = dev; |
2988 | } | 2988 | } |
2989 | 2989 | ||
2990 | /* Don't export sysctls to unprivileged users */ | ||
2991 | if (neigh_parms_net(p)->user_ns != &init_user_ns) | ||
2992 | t->neigh_vars[0].procname = NULL; | ||
2993 | |||
2990 | snprintf(neigh_path, sizeof(neigh_path), "net/%s/neigh/%s", | 2994 | snprintf(neigh_path, sizeof(neigh_path), "net/%s/neigh/%s", |
2991 | p_name, dev_name_source); | 2995 | p_name, dev_name_source); |
2992 | t->sysctl_header = | 2996 | t->sysctl_header = |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index a7c36845b123..d1b08045a9df 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -216,6 +216,11 @@ static __net_init int sysctl_core_net_init(struct net *net) | |||
216 | goto err_dup; | 216 | goto err_dup; |
217 | 217 | ||
218 | tbl[0].data = &net->core.sysctl_somaxconn; | 218 | tbl[0].data = &net->core.sysctl_somaxconn; |
219 | |||
220 | /* Don't export any sysctls to unprivileged users */ | ||
221 | if (net->user_ns != &init_user_ns) { | ||
222 | tbl[0].procname = NULL; | ||
223 | } | ||
219 | } | 224 | } |
220 | 225 | ||
221 | net->core.sysctl_hdr = register_net_sysctl(net, "net/core", tbl); | 226 | net->core.sysctl_hdr = register_net_sysctl(net, "net/core", tbl); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index f6db227c1fd9..6e06e924ed99 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1815,6 +1815,10 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name, | |||
1815 | t->devinet_vars[i].extra2 = net; | 1815 | t->devinet_vars[i].extra2 = net; |
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | /* Don't export sysctls to unprivileged users */ | ||
1819 | if (net->user_ns != &init_user_ns) | ||
1820 | t->devinet_vars[0].procname = NULL; | ||
1821 | |||
1818 | snprintf(path, sizeof(path), "net/ipv4/conf/%s", dev_name); | 1822 | snprintf(path, sizeof(path), "net/ipv4/conf/%s", dev_name); |
1819 | 1823 | ||
1820 | t->sysctl_header = register_net_sysctl(net, path, t->devinet_vars); | 1824 | t->sysctl_header = register_net_sysctl(net, path, t->devinet_vars); |
@@ -1900,6 +1904,10 @@ static __net_init int devinet_init_net(struct net *net) | |||
1900 | tbl[0].data = &all->data[IPV4_DEVCONF_FORWARDING - 1]; | 1904 | tbl[0].data = &all->data[IPV4_DEVCONF_FORWARDING - 1]; |
1901 | tbl[0].extra1 = all; | 1905 | tbl[0].extra1 = all; |
1902 | tbl[0].extra2 = net; | 1906 | tbl[0].extra2 = net; |
1907 | |||
1908 | /* Don't export sysctls to unprivileged users */ | ||
1909 | if (net->user_ns != &init_user_ns) | ||
1910 | tbl[0].procname = NULL; | ||
1903 | #endif | 1911 | #endif |
1904 | } | 1912 | } |
1905 | 1913 | ||
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 448e68546827..1cf6a768cd53 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -802,6 +802,10 @@ static int __net_init ip4_frags_ns_ctl_register(struct net *net) | |||
802 | table[0].data = &net->ipv4.frags.high_thresh; | 802 | table[0].data = &net->ipv4.frags.high_thresh; |
803 | table[1].data = &net->ipv4.frags.low_thresh; | 803 | table[1].data = &net->ipv4.frags.low_thresh; |
804 | table[2].data = &net->ipv4.frags.timeout; | 804 | table[2].data = &net->ipv4.frags.timeout; |
805 | |||
806 | /* Don't export sysctls to unprivileged users */ | ||
807 | if (net->user_ns != &init_user_ns) | ||
808 | table[0].procname = NULL; | ||
805 | } | 809 | } |
806 | 810 | ||
807 | hdr = register_net_sysctl(net, "net/ipv4", table); | 811 | hdr = register_net_sysctl(net, "net/ipv4", table); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a8c651216fa6..5b58788db863 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2493,6 +2493,10 @@ static __net_init int sysctl_route_net_init(struct net *net) | |||
2493 | tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); | 2493 | tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); |
2494 | if (tbl == NULL) | 2494 | if (tbl == NULL) |
2495 | goto err_dup; | 2495 | goto err_dup; |
2496 | |||
2497 | /* Don't export sysctls to unprivileged users */ | ||
2498 | if (net->user_ns != &init_user_ns) | ||
2499 | tbl[0].procname = NULL; | ||
2496 | } | 2500 | } |
2497 | tbl[0].extra1 = net; | 2501 | tbl[0].extra1 = net; |
2498 | 2502 | ||
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 63d4eccc674d..d84400b65049 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -883,6 +883,9 @@ static __net_init int ipv4_sysctl_init_net(struct net *net) | |||
883 | table[6].data = | 883 | table[6].data = |
884 | &net->ipv4.sysctl_ping_group_range; | 884 | &net->ipv4.sysctl_ping_group_range; |
885 | 885 | ||
886 | /* Don't export sysctls to unprivileged users */ | ||
887 | if (net->user_ns != &init_user_ns) | ||
888 | table[0].procname = NULL; | ||
886 | } | 889 | } |
887 | 890 | ||
888 | /* | 891 | /* |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index cb803b7bb0d8..b24b4de5cd26 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4735,6 +4735,10 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name, | |||
4735 | t->addrconf_vars[i].extra2 = net; | 4735 | t->addrconf_vars[i].extra2 = net; |
4736 | } | 4736 | } |
4737 | 4737 | ||
4738 | /* Don't export sysctls to unprivileged users */ | ||
4739 | if (net->user_ns != &init_user_ns) | ||
4740 | t->addrconf_vars[0].procname = NULL; | ||
4741 | |||
4738 | snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name); | 4742 | snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name); |
4739 | 4743 | ||
4740 | t->sysctl_header = register_net_sysctl(net, path, t->addrconf_vars); | 4744 | t->sysctl_header = register_net_sysctl(net, path, t->addrconf_vars); |
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) | |||
967 | sizeof(ipv6_icmp_table_template), | 967 | sizeof(ipv6_icmp_table_template), |
968 | GFP_KERNEL); | 968 | GFP_KERNEL); |
969 | 969 | ||
970 | if (table) | 970 | if (table) { |
971 | table[0].data = &net->ipv6.sysctl.icmpv6_time; | 971 | table[0].data = &net->ipv6.sysctl.icmpv6_time; |
972 | 972 | ||
973 | /* Don't export sysctls to unprivileged users */ | ||
974 | if (net->user_ns != &init_user_ns) | ||
975 | table[0].procname = NULL; | ||
976 | } | ||
977 | |||
973 | return table; | 978 | return table; |
974 | } | 979 | } |
975 | #endif | 980 | #endif |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index da8a4e301b1b..e5253ec9e0fc 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -616,6 +616,10 @@ static int __net_init ip6_frags_ns_sysctl_register(struct net *net) | |||
616 | table[0].data = &net->ipv6.frags.high_thresh; | 616 | table[0].data = &net->ipv6.frags.high_thresh; |
617 | table[1].data = &net->ipv6.frags.low_thresh; | 617 | table[1].data = &net->ipv6.frags.low_thresh; |
618 | table[2].data = &net->ipv6.frags.timeout; | 618 | table[2].data = &net->ipv6.frags.timeout; |
619 | |||
620 | /* Don't export sysctls to unprivileged users */ | ||
621 | if (net->user_ns != &init_user_ns) | ||
622 | table[0].procname = NULL; | ||
619 | } | 623 | } |
620 | 624 | ||
621 | hdr = register_net_sysctl(net, "net/ipv6", table); | 625 | hdr = register_net_sysctl(net, "net/ipv6", table); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 11249d211ea9..021a48e8a5e2 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2989,6 +2989,10 @@ struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net) | |||
2989 | table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires; | 2989 | table[7].data = &net->ipv6.sysctl.ip6_rt_mtu_expires; |
2990 | table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss; | 2990 | table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss; |
2991 | table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; | 2991 | table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; |
2992 | |||
2993 | /* Don't export sysctls to unprivileged users */ | ||
2994 | if (net->user_ns != &init_user_ns) | ||
2995 | table[0].procname = NULL; | ||
2992 | } | 2996 | } |
2993 | 2997 | ||
2994 | return table; | 2998 | return table; |
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index e85c48bd404f..b06fd078e6c7 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c | |||
@@ -52,6 +52,10 @@ static int __net_init ipv6_sysctl_net_init(struct net *net) | |||
52 | goto out; | 52 | goto out; |
53 | ipv6_table[0].data = &net->ipv6.sysctl.bindv6only; | 53 | ipv6_table[0].data = &net->ipv6.sysctl.bindv6only; |
54 | 54 | ||
55 | /* Don't export sysctls to unprivileged users */ | ||
56 | if (net->user_ns != &init_user_ns) | ||
57 | ipv6_table[0].procname = NULL; | ||
58 | |||
55 | ipv6_route_table = ipv6_route_sysctl_init(net); | 59 | ipv6_route_table = ipv6_route_sysctl_init(net); |
56 | if (!ipv6_route_table) | 60 | if (!ipv6_route_table) |
57 | goto out_ipv6_table; | 61 | goto out_ipv6_table; |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index c4ee43710aab..c6cebd560936 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3699,6 +3699,10 @@ static int __net_init ip_vs_control_net_init_sysctl(struct net *net) | |||
3699 | tbl = kmemdup(vs_vars, sizeof(vs_vars), GFP_KERNEL); | 3699 | tbl = kmemdup(vs_vars, sizeof(vs_vars), GFP_KERNEL); |
3700 | if (tbl == NULL) | 3700 | if (tbl == NULL) |
3701 | return -ENOMEM; | 3701 | return -ENOMEM; |
3702 | |||
3703 | /* Don't export sysctls to unprivileged users */ | ||
3704 | if (net->user_ns != &init_user_ns) | ||
3705 | tbl[0].procname = NULL; | ||
3702 | } else | 3706 | } else |
3703 | tbl = vs_vars; | 3707 | tbl = vs_vars; |
3704 | /* Initialize sysctl defaults */ | 3708 | /* Initialize sysctl defaults */ |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index cbd37489ac77..d742aa9780ec 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
@@ -560,6 +560,11 @@ static int __net_init __ip_vs_lblc_init(struct net *net) | |||
560 | GFP_KERNEL); | 560 | GFP_KERNEL); |
561 | if (ipvs->lblc_ctl_table == NULL) | 561 | if (ipvs->lblc_ctl_table == NULL) |
562 | return -ENOMEM; | 562 | return -ENOMEM; |
563 | |||
564 | /* Don't export sysctls to unprivileged users */ | ||
565 | if (net->user_ns != &init_user_ns) | ||
566 | ipvs->lblc_ctl_table[0].procname = NULL; | ||
567 | |||
563 | } else | 568 | } else |
564 | ipvs->lblc_ctl_table = vs_vars_table; | 569 | ipvs->lblc_ctl_table = vs_vars_table; |
565 | ipvs->sysctl_lblc_expiration = DEFAULT_EXPIRATION; | 570 | ipvs->sysctl_lblc_expiration = DEFAULT_EXPIRATION; |
@@ -569,7 +574,7 @@ static int __net_init __ip_vs_lblc_init(struct net *net) | |||
569 | register_net_sysctl(net, "net/ipv4/vs", ipvs->lblc_ctl_table); | 574 | register_net_sysctl(net, "net/ipv4/vs", ipvs->lblc_ctl_table); |
570 | if (!ipvs->lblc_ctl_header) { | 575 | if (!ipvs->lblc_ctl_header) { |
571 | if (!net_eq(net, &init_net)) | 576 | if (!net_eq(net, &init_net)) |
572 | kfree(ipvs->lblc_ctl_table); | 577 | kfree(ipvs->lblc_ctl_table);\ |
573 | return -ENOMEM; | 578 | return -ENOMEM; |
574 | } | 579 | } |
575 | 580 | ||
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index 161b67972e3f..c03b6a3ade2f 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
@@ -754,6 +754,10 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) | |||
754 | GFP_KERNEL); | 754 | GFP_KERNEL); |
755 | if (ipvs->lblcr_ctl_table == NULL) | 755 | if (ipvs->lblcr_ctl_table == NULL) |
756 | return -ENOMEM; | 756 | return -ENOMEM; |
757 | |||
758 | /* Don't export sysctls to unprivileged users */ | ||
759 | if (net->user_ns != &init_user_ns) | ||
760 | ipvs->lblcr_ctl_table[0].procname = NULL; | ||
757 | } else | 761 | } else |
758 | ipvs->lblcr_ctl_table = vs_vars_table; | 762 | ipvs->lblcr_ctl_table = vs_vars_table; |
759 | ipvs->sysctl_lblcr_expiration = DEFAULT_EXPIRATION; | 763 | ipvs->sysctl_lblcr_expiration = DEFAULT_EXPIRATION; |
diff --git a/net/netfilter/nf_conntrack_acct.c b/net/netfilter/nf_conntrack_acct.c index d61e0782a797..7df424e2d10c 100644 --- a/net/netfilter/nf_conntrack_acct.c +++ b/net/netfilter/nf_conntrack_acct.c | |||
@@ -69,6 +69,10 @@ static int nf_conntrack_acct_init_sysctl(struct net *net) | |||
69 | 69 | ||
70 | table[0].data = &net->ct.sysctl_acct; | 70 | table[0].data = &net->ct.sysctl_acct; |
71 | 71 | ||
72 | /* Don't export sysctls to unprivileged users */ | ||
73 | if (net->user_ns != &init_user_ns) | ||
74 | table[0].procname = NULL; | ||
75 | |||
72 | net->ct.acct_sysctl_header = register_net_sysctl(net, "net/netfilter", | 76 | net->ct.acct_sysctl_header = register_net_sysctl(net, "net/netfilter", |
73 | table); | 77 | table); |
74 | if (!net->ct.acct_sysctl_header) { | 78 | if (!net->ct.acct_sysctl_header) { |
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c index de9781b6464f..faa978f1714b 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c | |||
@@ -196,6 +196,10 @@ static int nf_conntrack_event_init_sysctl(struct net *net) | |||
196 | table[0].data = &net->ct.sysctl_events; | 196 | table[0].data = &net->ct.sysctl_events; |
197 | table[1].data = &net->ct.sysctl_events_retry_timeout; | 197 | table[1].data = &net->ct.sysctl_events_retry_timeout; |
198 | 198 | ||
199 | /* Don't export sysctls to unprivileged users */ | ||
200 | if (net->user_ns != &init_user_ns) | ||
201 | table[0].procname = NULL; | ||
202 | |||
199 | net->ct.event_sysctl_header = | 203 | net->ct.event_sysctl_header = |
200 | register_net_sysctl(net, "net/netfilter", table); | 204 | register_net_sysctl(net, "net/netfilter", table); |
201 | if (!net->ct.event_sysctl_header) { | 205 | if (!net->ct.event_sysctl_header) { |
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c index c4bc637feb76..884f2b39319a 100644 --- a/net/netfilter/nf_conntrack_helper.c +++ b/net/netfilter/nf_conntrack_helper.c | |||
@@ -64,6 +64,10 @@ static int nf_conntrack_helper_init_sysctl(struct net *net) | |||
64 | 64 | ||
65 | table[0].data = &net->ct.sysctl_auto_assign_helper; | 65 | table[0].data = &net->ct.sysctl_auto_assign_helper; |
66 | 66 | ||
67 | /* Don't export sysctls to unprivileged users */ | ||
68 | if (net->user_ns != &init_user_ns) | ||
69 | table[0].procname = NULL; | ||
70 | |||
67 | net->ct.helper_sysctl_header = | 71 | net->ct.helper_sysctl_header = |
68 | register_net_sysctl(net, "net/netfilter", table); | 72 | register_net_sysctl(net, "net/netfilter", table); |
69 | 73 | ||
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index 6535326cf07c..a8ae287bc7af 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
@@ -815,7 +815,7 @@ static struct ctl_table dccp_sysctl_table[] = { | |||
815 | }; | 815 | }; |
816 | #endif /* CONFIG_SYSCTL */ | 816 | #endif /* CONFIG_SYSCTL */ |
817 | 817 | ||
818 | static int dccp_kmemdup_sysctl_table(struct nf_proto_net *pn, | 818 | static int dccp_kmemdup_sysctl_table(struct net *net, struct nf_proto_net *pn, |
819 | struct dccp_net *dn) | 819 | struct dccp_net *dn) |
820 | { | 820 | { |
821 | #ifdef CONFIG_SYSCTL | 821 | #ifdef CONFIG_SYSCTL |
@@ -836,6 +836,10 @@ static int dccp_kmemdup_sysctl_table(struct nf_proto_net *pn, | |||
836 | pn->ctl_table[5].data = &dn->dccp_timeout[CT_DCCP_CLOSING]; | 836 | pn->ctl_table[5].data = &dn->dccp_timeout[CT_DCCP_CLOSING]; |
837 | pn->ctl_table[6].data = &dn->dccp_timeout[CT_DCCP_TIMEWAIT]; | 837 | pn->ctl_table[6].data = &dn->dccp_timeout[CT_DCCP_TIMEWAIT]; |
838 | pn->ctl_table[7].data = &dn->dccp_loose; | 838 | pn->ctl_table[7].data = &dn->dccp_loose; |
839 | |||
840 | /* Don't export sysctls to unprivileged users */ | ||
841 | if (net->user_ns != &init_user_ns) | ||
842 | pn->ctl_table[0].procname = NULL; | ||
839 | #endif | 843 | #endif |
840 | return 0; | 844 | return 0; |
841 | } | 845 | } |
@@ -857,7 +861,7 @@ static int dccp_init_net(struct net *net, u_int16_t proto) | |||
857 | dn->dccp_timeout[CT_DCCP_TIMEWAIT] = 2 * DCCP_MSL; | 861 | dn->dccp_timeout[CT_DCCP_TIMEWAIT] = 2 * DCCP_MSL; |
858 | } | 862 | } |
859 | 863 | ||
860 | return dccp_kmemdup_sysctl_table(pn, dn); | 864 | return dccp_kmemdup_sysctl_table(net, pn, dn); |
861 | } | 865 | } |
862 | 866 | ||
863 | static struct nf_conntrack_l4proto dccp_proto4 __read_mostly = { | 867 | static struct nf_conntrack_l4proto dccp_proto4 __read_mostly = { |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 9b3943252a5e..363285d544a1 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -489,6 +489,10 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net) | |||
489 | table[3].data = &net->ct.sysctl_checksum; | 489 | table[3].data = &net->ct.sysctl_checksum; |
490 | table[4].data = &net->ct.sysctl_log_invalid; | 490 | table[4].data = &net->ct.sysctl_log_invalid; |
491 | 491 | ||
492 | /* Don't export sysctls to unprivileged users */ | ||
493 | if (net->user_ns != &init_user_ns) | ||
494 | table[0].procname = NULL; | ||
495 | |||
492 | net->ct.sysctl_header = register_net_sysctl(net, "net/netfilter", table); | 496 | net->ct.sysctl_header = register_net_sysctl(net, "net/netfilter", table); |
493 | if (!net->ct.sysctl_header) | 497 | if (!net->ct.sysctl_header) |
494 | goto out_unregister_netfilter; | 498 | goto out_unregister_netfilter; |
diff --git a/net/netfilter/nf_conntrack_timestamp.c b/net/netfilter/nf_conntrack_timestamp.c index dbb364f62d6f..7ea8026f07c9 100644 --- a/net/netfilter/nf_conntrack_timestamp.c +++ b/net/netfilter/nf_conntrack_timestamp.c | |||
@@ -51,6 +51,10 @@ static int nf_conntrack_tstamp_init_sysctl(struct net *net) | |||
51 | 51 | ||
52 | table[0].data = &net->ct.sysctl_tstamp; | 52 | table[0].data = &net->ct.sysctl_tstamp; |
53 | 53 | ||
54 | /* Don't export sysctls to unprivileged users */ | ||
55 | if (net->user_ns != &init_user_ns) | ||
56 | table[0].procname = NULL; | ||
57 | |||
54 | net->ct.tstamp_sysctl_header = register_net_sysctl(net, "net/netfilter", | 58 | net->ct.tstamp_sysctl_header = register_net_sysctl(net, "net/netfilter", |
55 | table); | 59 | table); |
56 | if (!net->ct.tstamp_sysctl_header) { | 60 | if (!net->ct.tstamp_sysctl_header) { |
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c index b34b5b9792f0..8800604c93f4 100644 --- a/net/unix/sysctl_net_unix.c +++ b/net/unix/sysctl_net_unix.c | |||
@@ -34,6 +34,10 @@ int __net_init unix_sysctl_register(struct net *net) | |||
34 | if (table == NULL) | 34 | if (table == NULL) |
35 | goto err_alloc; | 35 | goto err_alloc; |
36 | 36 | ||
37 | /* Don't export sysctls to unprivileged users */ | ||
38 | if (net->user_ns != &init_user_ns) | ||
39 | table[0].procname = NULL; | ||
40 | |||
37 | table[0].data = &net->unx.sysctl_max_dgram_qlen; | 41 | table[0].data = &net->unx.sysctl_max_dgram_qlen; |
38 | net->unx.ctl = register_net_sysctl(net, "net/unix", table); | 42 | net->unx.ctl = register_net_sysctl(net, "net/unix", table); |
39 | if (net->unx.ctl == NULL) | 43 | if (net->unx.ctl == NULL) |
diff --git a/net/xfrm/xfrm_sysctl.c b/net/xfrm/xfrm_sysctl.c index 380976f74c4c..05a6e3d9c258 100644 --- a/net/xfrm/xfrm_sysctl.c +++ b/net/xfrm/xfrm_sysctl.c | |||
@@ -54,6 +54,10 @@ int __net_init xfrm_sysctl_init(struct net *net) | |||
54 | table[2].data = &net->xfrm.sysctl_larval_drop; | 54 | table[2].data = &net->xfrm.sysctl_larval_drop; |
55 | table[3].data = &net->xfrm.sysctl_acq_expires; | 55 | table[3].data = &net->xfrm.sysctl_acq_expires; |
56 | 56 | ||
57 | /* Don't export sysctls to unprivileged users */ | ||
58 | if (net->user_ns != &init_user_ns) | ||
59 | table[0].procname = NULL; | ||
60 | |||
57 | net->xfrm.sysctl_hdr = register_net_sysctl(net, "net/core", table); | 61 | net->xfrm.sysctl_hdr = register_net_sysctl(net, "net/core", table); |
58 | if (!net->xfrm.sysctl_hdr) | 62 | if (!net->xfrm.sysctl_hdr) |
59 | goto out_register; | 63 | goto out_register; |