aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f2c7e615f902..26512250e095 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4784,26 +4784,20 @@ static void addrconf_sysctl_unregister(struct inet6_dev *idev)
4784 4784
4785static int __net_init addrconf_init_net(struct net *net) 4785static int __net_init addrconf_init_net(struct net *net)
4786{ 4786{
4787 int err; 4787 int err = -ENOMEM;
4788 struct ipv6_devconf *all, *dflt; 4788 struct ipv6_devconf *all, *dflt;
4789 4789
4790 err = -ENOMEM; 4790 all = kmemdup(&ipv6_devconf, sizeof(ipv6_devconf), GFP_KERNEL);
4791 all = &ipv6_devconf; 4791 if (all == NULL)
4792 dflt = &ipv6_devconf_dflt; 4792 goto err_alloc_all;
4793 4793
4794 if (!net_eq(net, &init_net)) { 4794 dflt = kmemdup(&ipv6_devconf_dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL);
4795 all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL); 4795 if (dflt == NULL)
4796 if (all == NULL) 4796 goto err_alloc_dflt;
4797 goto err_alloc_all;
4798 4797
4799 dflt = kmemdup(dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL); 4798 /* these will be inherited by all namespaces */
4800 if (dflt == NULL) 4799 dflt->autoconf = ipv6_defaults.autoconf;
4801 goto err_alloc_dflt; 4800 dflt->disable_ipv6 = ipv6_defaults.disable_ipv6;
4802 } else {
4803 /* these will be inherited by all namespaces */
4804 dflt->autoconf = ipv6_defaults.autoconf;
4805 dflt->disable_ipv6 = ipv6_defaults.disable_ipv6;
4806 }
4807 4801
4808 net->ipv6.devconf_all = all; 4802 net->ipv6.devconf_all = all;
4809 net->ipv6.devconf_dflt = dflt; 4803 net->ipv6.devconf_dflt = dflt;