Skip to content

Commit cd9d1a2

Browse files
committed
Merge branch 'mlxsw-Various-fixes'
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]>
2 parents ebaf39e + 993107f commit cd9d1a2

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ static void mlxsw_sp_nve_mc_list_ip_del(struct mlxsw_sp *mlxsw_sp,
560560

561561
mc_record = mlxsw_sp_nve_mc_record_find(mc_list, proto, addr,
562562
&mc_entry);
563-
if (WARN_ON(!mc_record))
563+
if (!mc_record)
564564
return;
565565

566566
mlxsw_sp_nve_mc_record_entry_del(mc_record, mc_entry);
@@ -647,7 +647,7 @@ void mlxsw_sp_nve_flood_ip_del(struct mlxsw_sp *mlxsw_sp,
647647

648648
key.fid_index = mlxsw_sp_fid_index(fid);
649649
mc_list = mlxsw_sp_nve_mc_list_find(mlxsw_sp, &key);
650-
if (WARN_ON(!mc_list))
650+
if (!mc_list)
651651
return;
652652

653653
mlxsw_sp_nve_fid_flood_index_clear(fid, mc_list);

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -1275,15 +1275,12 @@ mlxsw_sp_ipip_entry_matches_decap(struct mlxsw_sp *mlxsw_sp,
12751275
{
12761276
u32 ul_tb_id = l3mdev_fib_table(ul_dev) ? : RT_TABLE_MAIN;
12771277
enum mlxsw_sp_ipip_type ipipt = ipip_entry->ipipt;
1278-
struct net_device *ipip_ul_dev;
12791278

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

1283-
ipip_ul_dev = __mlxsw_sp_ipip_netdev_ul_dev_get(ipip_entry->ol_dev);
12841282
return mlxsw_sp_ipip_entry_saddr_matches(mlxsw_sp, ul_proto, ul_dip,
1285-
ul_tb_id, ipip_entry) &&
1286-
(!ipip_ul_dev || ipip_ul_dev == ul_dev);
1283+
ul_tb_id, ipip_entry);
12871284
}
12881285

12891286
/* Given decap parameters, find the corresponding IPIP entry. */

drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c

+13-4
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,13 @@ static bool
296296
mlxsw_sp_bridge_port_should_destroy(const struct mlxsw_sp_bridge_port *
297297
bridge_port)
298298
{
299-
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_port->dev);
299+
struct net_device *dev = bridge_port->dev;
300+
struct mlxsw_sp *mlxsw_sp;
301+
302+
if (is_vlan_dev(dev))
303+
mlxsw_sp = mlxsw_sp_lower_get(vlan_dev_real_dev(dev));
304+
else
305+
mlxsw_sp = mlxsw_sp_lower_get(dev);
300306

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

21102116
vid = is_vlan_dev(dev) ? vlan_dev_vlan_id(dev) : 1;
21112117
mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid);
2112-
if (WARN_ON(!mlxsw_sp_port_vlan))
2118+
if (!mlxsw_sp_port_vlan)
21132119
return;
21142120

21152121
mlxsw_sp_port_vlan_bridge_leave(mlxsw_sp_port_vlan);
@@ -2134,8 +2140,10 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
21342140
if (!fid)
21352141
return -EINVAL;
21362142

2137-
if (mlxsw_sp_fid_vni_is_set(fid))
2138-
return -EINVAL;
2143+
if (mlxsw_sp_fid_vni_is_set(fid)) {
2144+
err = -EINVAL;
2145+
goto err_vni_exists;
2146+
}
21392147

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

21512159
err_nve_fid_enable:
2160+
err_vni_exists:
21522161
mlxsw_sp_fid_put(fid);
21532162
return err;
21542163
}

0 commit comments

Comments
 (0)