macvlan: Fix one possible double free
authorGao Feng <gfree.wind@vip.163.com>
Tue, 26 Dec 2017 13:44:32 +0000 (21:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:24:33 +0000 (10:24 +0100)
commitf22fec25935dee1dd769c84f100b173e1565c335
tree0e0dfdb5cca9b369e63e6e87a9ba2c63c3fe5f8b
parent4d3d428c56a04893782a8d0b1e2b4ad8b34a5f45
macvlan: Fix one possible double free

[ Upstream commit d02fd6e7d2933ede6478a15f9e4ce8a93845824e ]

Because the macvlan_uninit would free the macvlan port, so there is one
double free case in macvlan_common_newlink. When the macvlan port is just
created, then register_netdevice or netdev_upper_dev_link failed and they
would invoke macvlan_uninit. Then it would reach the macvlan_port_destroy
which triggers the double free.

Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/macvlan.c