[Devel] [PATCH RHEL7 COMMIT] ms/macvlan: unregister net device when netdev_upper_dev_link() fails

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jan 11 08:19:37 PST 2017


The commit is pushed to "branch-rh7-3.10.0-514.vz7.27.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.vz7.27.9
------>
commit 5fdf0a73250e93877a68d57948f4237134d0d522
Author: Cong Wang <cwang at twopensource.com>
Date:   Wed Jan 11 20:19:37 2017 +0400

    ms/macvlan: unregister net device when netdev_upper_dev_link() fails
    
    rtnl_newlink() doesn't unregister it for us on failure.
    
    Cc: Patrick McHardy <kaber at trash.net>
    Cc: David S. Miller <davem at davemloft.net>
    Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
    Signed-off-by: Cong Wang <cwang at twopensource.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>
    
    ms commit: da37705 ("macvlan: unregister net device when
    netdev_upper_dev_link() fails")
    
    https://jira.sw.ru/browse/PSBM-58300
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    Acked-by: Andrew Vagin <avagin at 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)


More information about the Devel mailing list