summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorCong Wang <cwang@twopensource.com>2014-02-11 15:51:29 -0800
committerDavid S. Miller <davem@davemloft.net>2014-02-13 17:08:28 -0500
commitda37705cef30841616ed644ff33455bbc7374db0 (patch)
treec437ce711eb9d8fa5b3f90007655743b04f30471 /drivers/net
parent64380a04deeed4720de76b086a3a4eab8dd41671 (diff)
macvlan: unregister net device when netdev_upper_dev_link() fails
rtnl_newlink() doesn't unregister it for us on failure. Cc: Patrick McHardy <kaber@trash.net> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Cong Wang <cwang@twopensource.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/macvlan.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 8433de4509c7..a5d21893670d 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -879,14 +879,15 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
dev->priv_flags |= IFF_MACVLAN;
err = netdev_upper_dev_link(lowerdev, dev);
if (err)
- goto destroy_port;
-
+ goto unregister_netdev;
list_add_tail_rcu(&vlan->list, &port->vlans);
netif_stacked_transfer_operstate(lowerdev, dev);
return 0;
+unregister_netdev:
+ unregister_netdevice(dev);
destroy_port:
port->count -= 1;
if (!port->count)