diff options
| -rw-r--r-- | drivers/net/macvlan.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 4e238afab4a3..87e8d4cb4057 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
| @@ -634,11 +634,18 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | |||
| 634 | 634 | ||
| 635 | err = register_netdevice(dev); | 635 | err = register_netdevice(dev); |
| 636 | if (err < 0) | 636 | if (err < 0) |
| 637 | return err; | 637 | goto destroy_port; |
| 638 | 638 | ||
| 639 | list_add_tail(&vlan->list, &port->vlans); | 639 | list_add_tail(&vlan->list, &port->vlans); |
| 640 | netif_stacked_transfer_operstate(lowerdev, dev); | 640 | netif_stacked_transfer_operstate(lowerdev, dev); |
| 641 | |||
| 641 | return 0; | 642 | return 0; |
| 643 | |||
| 644 | destroy_port: | ||
| 645 | if (list_empty(&port->vlans)) | ||
| 646 | macvlan_port_destroy(lowerdev); | ||
| 647 | |||
| 648 | return err; | ||
| 642 | } | 649 | } |
| 643 | EXPORT_SYMBOL_GPL(macvlan_common_newlink); | 650 | EXPORT_SYMBOL_GPL(macvlan_common_newlink); |
| 644 | 651 | ||
