aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/core/sysctl_net_core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 57a7eadb8551..dc4cf7dda9d1 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -167,8 +167,13 @@ static __net_init int sysctl_core_net_init(struct net *net)
167 if (tbl == NULL) 167 if (tbl == NULL)
168 goto err_dup; 168 goto err_dup;
169 169
170 for (tmp = tbl; tmp->procname; tmp++) 170 for (tmp = tbl; tmp->procname; tmp++) {
171 tmp->mode &= ~0222; 171 if (tmp->data >= (void *)&init_net &&
172 tmp->data < (void *)(&init_net + 1))
173 tmp->data += (char *)net - (char *)&init_net;
174 else
175 tmp->mode &= ~0222;
176 }
172 } 177 }
173 178
174 net->sysctl_core_hdr = register_net_sysctl_table(net, 179 net->sysctl_core_hdr = register_net_sysctl_table(net,