net/mlx5e: Prevent adding the same vxlan port
authorMatthew Finlay <matt@mellanox.com>
Mon, 27 Jun 2016 09:08:36 +0000 (12:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Jun 2016 08:28:46 +0000 (04:28 -0400)
Do not allow the same vxlan udp port to be added to the device more than
once.

Fixes: b3f63c3d5e2c ("net/mlx5e: Add netdev support for VXLAN tunneling")
Signed-off-by: Matthew Finlay <matt@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/vxlan.c

index f2fd1ef16da7eba68deb5af1648b7ff28cf7ff44..05de77267d58a910193715fa85cdb411f9858457 100644 (file)
@@ -105,6 +105,9 @@ static void mlx5e_vxlan_add_port(struct work_struct *work)
        struct mlx5e_vxlan *vxlan;
        int err;
 
+       if (mlx5e_vxlan_lookup_port(priv, port))
+               goto free_work;
+
        if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port))
                goto free_work;