Commit 8603e33d authored by Roy Li's avatar Roy Li Committed by David S. Miller

ipv6: fix a possible double free

When calling snmp6_alloc_dev fails, the snmp6 relevant memory
are freed by snmp6_alloc_dev. Calling in6_dev_finish_destroy
will free these memory twice.

Double free will lead that undefined behavior occurs.
Signed-off-by: default avatarRoy Li <rongqing.li@windriver.com>
Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fe7d189d
...@@ -374,8 +374,8 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) ...@@ -374,8 +374,8 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
"%s(): cannot allocate memory for statistics; dev=%s.\n", "%s(): cannot allocate memory for statistics; dev=%s.\n",
__func__, dev->name)); __func__, dev->name));
neigh_parms_release(&nd_tbl, ndev->nd_parms); neigh_parms_release(&nd_tbl, ndev->nd_parms);
ndev->dead = 1; dev_put(dev);
in6_dev_finish_destroy(ndev); kfree(ndev);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment