aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/veth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r--drivers/net/veth.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 38f0f03a29c8..364fa9d11d1a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -222,7 +222,6 @@ static int veth_dev_init(struct net_device *dev)
222static void veth_dev_free(struct net_device *dev) 222static void veth_dev_free(struct net_device *dev)
223{ 223{
224 free_percpu(dev->vstats); 224 free_percpu(dev->vstats);
225 free_netdev(dev);
226} 225}
227 226
228#ifdef CONFIG_NET_POLL_CONTROLLER 227#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -317,7 +316,8 @@ static void veth_setup(struct net_device *dev)
317 NETIF_F_HW_VLAN_STAG_TX | 316 NETIF_F_HW_VLAN_STAG_TX |
318 NETIF_F_HW_VLAN_CTAG_RX | 317 NETIF_F_HW_VLAN_CTAG_RX |
319 NETIF_F_HW_VLAN_STAG_RX); 318 NETIF_F_HW_VLAN_STAG_RX);
320 dev->destructor = veth_dev_free; 319 dev->needs_free_netdev = true;
320 dev->priv_destructor = veth_dev_free;
321 dev->max_mtu = ETH_MAX_MTU; 321 dev->max_mtu = ETH_MAX_MTU;
322 322
323 dev->hw_features = VETH_FEATURES; 323 dev->hw_features = VETH_FEATURES;
@@ -383,7 +383,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
383 tbp = tb; 383 tbp = tb;
384 } 384 }
385 385
386 if (tbp[IFLA_IFNAME]) { 386 if (ifmp && tbp[IFLA_IFNAME]) {
387 nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ); 387 nla_strlcpy(ifname, tbp[IFLA_IFNAME], IFNAMSIZ);
388 name_assign_type = NET_NAME_USER; 388 name_assign_type = NET_NAME_USER;
389 } else { 389 } else {
@@ -402,7 +402,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
402 return PTR_ERR(peer); 402 return PTR_ERR(peer);
403 } 403 }
404 404
405 if (tbp[IFLA_ADDRESS] == NULL) 405 if (!ifmp || !tbp[IFLA_ADDRESS])
406 eth_hw_addr_random(peer); 406 eth_hw_addr_random(peer);
407 407
408 if (ifmp && (dev->ifindex != 0)) 408 if (ifmp && (dev->ifindex != 0))