From: Cong Wang <cw...@twopensource.com>

rtnl_newlink() doesn't unregister it for us on failure.

https://jira.sw.ru/browse/PSBM-58300

Cc: Patrick McHardy <ka...@trash.net>
Cc: David S. Miller <da...@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangc...@gmail.com>
Signed-off-by: Cong Wang <cw...@twopensource.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com>
---
 drivers/net/macvlan.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index a6bbb1d..808cf38 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -966,8 +966,7 @@ int macvlan_common_newlink(struct net *src_net, struct 
net_device *dev,
 
        err = netdev_upper_dev_link(lowerdev, dev);
        if (err)
-               goto destroy_port;
-
+               goto unregister_netdev;
 
        dev->priv_flags |= IFF_MACVLAN;
        list_add_tail_rcu(&vlan->list, &port->vlans);
@@ -975,6 +974,8 @@ int macvlan_common_newlink(struct net *src_net, struct 
net_device *dev,
 
        return 0;
 
+unregister_netdev:
+       unregister_netdevice(dev);
 destroy_port:
        port->count -= 1;
        if (!port->count)
-- 
2.9.3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to