net/mlx5: Prevent setting multicast macs for VFs
authorMohamad Haj Yahia <mohamad@mellanox.com>
Wed, 28 Dec 2016 12:58:37 +0000 (14:58 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Dec 2016 19:36:52 +0000 (14:36 -0500)
Need to check that VF mac address entered by the admin user is either
zero or unicast mac.
Multicast mac addresses are prohibited.

Fixes: 77256579c6b4 ('net/mlx5: E-Switch, Introduce Vport administration functions')
Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c

index d6807c3cc461f001aa01072e395adf2e93095bfd..f14d9c9ba77394b83aea50564afd3c762613467a 100644 (file)
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
 
        if (!ESW_ALLOWED(esw))
                return -EPERM;
-       if (!LEGAL_VPORT(esw, vport))
+       if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
                return -EINVAL;
 
        mutex_lock(&esw->state_lock);