Skip to content

Commit

Permalink
macvlan: unregister net device when netdev_upper_dev_link() fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cong Wang authored and David S. Miller committed Feb 13, 2014
1 parent 64380a0 commit da37705
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit da37705

Please sign in to comment.