ipv6: fix bad free of addrconf_init_net
Signed-off-by: Hong Zhiguo <honkiko@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ded34e0fe8
commit
a79ca223e0
1 changed files with 10 additions and 16 deletions
|
@ -4784,26 +4784,20 @@ static void addrconf_sysctl_unregister(struct inet6_dev *idev)
|
||||||
|
|
||||||
static int __net_init addrconf_init_net(struct net *net)
|
static int __net_init addrconf_init_net(struct net *net)
|
||||||
{
|
{
|
||||||
int err;
|
int err = -ENOMEM;
|
||||||
struct ipv6_devconf *all, *dflt;
|
struct ipv6_devconf *all, *dflt;
|
||||||
|
|
||||||
err = -ENOMEM;
|
all = kmemdup(&ipv6_devconf, sizeof(ipv6_devconf), GFP_KERNEL);
|
||||||
all = &ipv6_devconf;
|
if (all == NULL)
|
||||||
dflt = &ipv6_devconf_dflt;
|
goto err_alloc_all;
|
||||||
|
|
||||||
if (!net_eq(net, &init_net)) {
|
dflt = kmemdup(&ipv6_devconf_dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL);
|
||||||
all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL);
|
if (dflt == NULL)
|
||||||
if (all == NULL)
|
goto err_alloc_dflt;
|
||||||
goto err_alloc_all;
|
|
||||||
|
|
||||||
dflt = kmemdup(dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL);
|
/* these will be inherited by all namespaces */
|
||||||
if (dflt == NULL)
|
dflt->autoconf = ipv6_defaults.autoconf;
|
||||||
goto err_alloc_dflt;
|
dflt->disable_ipv6 = ipv6_defaults.disable_ipv6;
|
||||||
} else {
|
|
||||||
/* these will be inherited by all namespaces */
|
|
||||||
dflt->autoconf = ipv6_defaults.autoconf;
|
|
||||||
dflt->disable_ipv6 = ipv6_defaults.disable_ipv6;
|
|
||||||
}
|
|
||||||
|
|
||||||
net->ipv6.devconf_all = all;
|
net->ipv6.devconf_all = all;
|
||||||
net->ipv6.devconf_dflt = dflt;
|
net->ipv6.devconf_dflt = dflt;
|
||||||
|
|
Loading…
Reference in a new issue