]> Pileus Git - ~andy/linux/blobdiff - net/ipv4/sysctl_net_ipv4.c
ipmr/ip6mr: allow to get unresolved cache via netlink
[~andy/linux] / net / ipv4 / sysctl_net_ipv4.c
index 9205e492dc9d8a36b05f18ccedcdf4704867c986..d84400b65049e61bc64f8f8eef37e2be2aaf2eda 100644 (file)
@@ -248,6 +248,8 @@ int proc_tcp_fastopen_key(ctl_table *ctl, int write, void __user *buffer,
        ctxt = rcu_dereference(tcp_fastopen_ctx);
        if (ctxt)
                memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH);
+       else
+               memset(user_key, 0, sizeof(user_key));
        rcu_read_unlock();
 
        snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x",
@@ -881,6 +883,9 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
                table[6].data =
                        &net->ipv4.sysctl_ping_group_range;
 
+               /* Don't export sysctls to unprivileged users */
+               if (net->user_ns != &init_user_ns)
+                       table[0].procname = NULL;
        }
 
        /*