[PATCH] net-veth: Fix memleak in veth_newlink
From: Dinghao Liu
Date: Thu Oct 22 2020 - 01:42:56 EST
When rtnl_configure_link() fails, peer needs to be
freed just like when register_netdevice() fails.
Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
---
drivers/net/veth.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 8c737668008a..6c68094399cc 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1405,8 +1405,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
/* nothing to do */
err_configure_peer:
unregister_netdevice(peer);
- return err;
-
err_register_peer:
free_netdev(peer);
return err;
--
2.17.1