diff options
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f18149ae2588..36a16d581f71 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -679,11 +679,12 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p) | |||
679 | { | 679 | { |
680 | struct virtnet_info *vi = netdev_priv(dev); | 680 | struct virtnet_info *vi = netdev_priv(dev); |
681 | struct virtio_device *vdev = vi->vdev; | 681 | struct virtio_device *vdev = vi->vdev; |
682 | int ret; | 682 | struct sockaddr *addr = p; |
683 | 683 | ||
684 | ret = eth_mac_addr(dev, p); | 684 | if (!is_valid_ether_addr(addr->sa_data)) |
685 | if (ret) | 685 | return -EADDRNOTAVAIL; |
686 | return ret; | 686 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); |
687 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; | ||
687 | 688 | ||
688 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) | 689 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) |
689 | vdev->config->set(vdev, offsetof(struct virtio_net_config, mac), | 690 | vdev->config->set(vdev, offsetof(struct virtio_net_config, mac), |