2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-18 10:13:57 +08:00

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: Roy Li <rongqing.li@windriver.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Roy Li 2011-09-20 15:10:16 -04:00 committed by David S. Miller
parent fe7d189d4a
commit 8603e33d01

View File

@ -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;
} }