Skip to content

Commit

Permalink
Merge branch 'mlxsw-Various-fixes'
Browse files Browse the repository at this point in the history
Ido Schimmel says:

====================
mlxsw: Various fixes

Patches #1 and #2 fix two VxLAN related issues. The first patch removes
warnings that can currently be triggered from user space. Second patch
avoids leaking a FID in an error path.

Patch #3 fixes a too strict check that causes certain host routes not to
be promoted to perform GRE decapsulation in hardware.

Last patch avoids a use-after-free when deleting a VLAN device via an
ioctl when it is enslaved to a bridge. I have a patchset for net-next
that reworks this code and makes the driver more robust.
====================

Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Dec 6, 2018
2 parents ebaf39e + 993107f commit cd9d1a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ static void mlxsw_sp_nve_mc_list_ip_del(struct mlxsw_sp *mlxsw_sp,

mc_record = mlxsw_sp_nve_mc_record_find(mc_list, proto, addr,
&mc_entry);
if (WARN_ON(!mc_record))
if (!mc_record)
return;

mlxsw_sp_nve_mc_record_entry_del(mc_record, mc_entry);
Expand Down Expand Up @@ -647,7 +647,7 @@ void mlxsw_sp_nve_flood_ip_del(struct mlxsw_sp *mlxsw_sp,

key.fid_index = mlxsw_sp_fid_index(fid);
mc_list = mlxsw_sp_nve_mc_list_find(mlxsw_sp, &key);
if (WARN_ON(!mc_list))
if (!mc_list)
return;

mlxsw_sp_nve_fid_flood_index_clear(fid, mc_list);
Expand Down
5 changes: 1 addition & 4 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,15 +1275,12 @@ mlxsw_sp_ipip_entry_matches_decap(struct mlxsw_sp *mlxsw_sp,
{
u32 ul_tb_id = l3mdev_fib_table(ul_dev) ? : RT_TABLE_MAIN;
enum mlxsw_sp_ipip_type ipipt = ipip_entry->ipipt;
struct net_device *ipip_ul_dev;

if (mlxsw_sp->router->ipip_ops_arr[ipipt]->ul_proto != ul_proto)
return false;

ipip_ul_dev = __mlxsw_sp_ipip_netdev_ul_dev_get(ipip_entry->ol_dev);
return mlxsw_sp_ipip_entry_saddr_matches(mlxsw_sp, ul_proto, ul_dip,
ul_tb_id, ipip_entry) &&
(!ipip_ul_dev || ipip_ul_dev == ul_dev);
ul_tb_id, ipip_entry);
}

/* Given decap parameters, find the corresponding IPIP entry. */
Expand Down
17 changes: 13 additions & 4 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,13 @@ static bool
mlxsw_sp_bridge_port_should_destroy(const struct mlxsw_sp_bridge_port *
bridge_port)
{
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_port->dev);
struct net_device *dev = bridge_port->dev;
struct mlxsw_sp *mlxsw_sp;

if (is_vlan_dev(dev))
mlxsw_sp = mlxsw_sp_lower_get(vlan_dev_real_dev(dev));
else
mlxsw_sp = mlxsw_sp_lower_get(dev);

/* In case ports were pulled from out of a bridged LAG, then
* it's possible the reference count isn't zero, yet the bridge
Expand Down Expand Up @@ -2109,7 +2115,7 @@ mlxsw_sp_bridge_8021d_port_leave(struct mlxsw_sp_bridge_device *bridge_device,

vid = is_vlan_dev(dev) ? vlan_dev_vlan_id(dev) : 1;
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
if (WARN_ON(!mlxsw_sp_port_vlan))
if (!mlxsw_sp_port_vlan)
return;

mlxsw_sp_port_vlan_bridge_leave(mlxsw_sp_port_vlan);
Expand All @@ -2134,8 +2140,10 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
if (!fid)
return -EINVAL;

if (mlxsw_sp_fid_vni_is_set(fid))
return -EINVAL;
if (mlxsw_sp_fid_vni_is_set(fid)) {
err = -EINVAL;
goto err_vni_exists;
}

err = mlxsw_sp_nve_fid_enable(mlxsw_sp, fid, &params, extack);
if (err)
Expand All @@ -2149,6 +2157,7 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
return 0;

err_nve_fid_enable:
err_vni_exists:
mlxsw_sp_fid_put(fid);
return err;
}
Expand Down

0 comments on commit cd9d1a2

Please sign in to comment.