From: Saeed Mahameed <saeedm@nvidia.com>
Hi Dave and Jakub,
This series introduces some fixes to mlx5 driver.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit 73367f05b25dbd064061aee780638564d15b01d1:
Merge tag 'nfsd-5.14-1' of git://linux-nfs.org/~bfields/linux (2021-08-26 13:26:40 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-08-26
for you to fetch changes up to 6cc64770fb386b10a64a1fe09328396de7bb5262:
net/mlx5: DR, fix a potential use-after-free bug (2021-08-26 15:15:42 -0700)
----------------------------------------------------------------
mlx5-fixes-2021-08-26
----------------------------------------------------------------
Dima Chumak (1):
net/mlx5: Lag, fix multipath lag activation
Dmytro Linkin (1):
net/mlx5e: Use correct eswitch for stack devices with lag
Leon Romanovsky (1):
net/mlx5: Remove all auxiliary devices at the unregister event
Maor Dickman (1):
net/mlx5: E-Switch, Set vhca id valid flag when creating indir fwd group
Roi Dayan (1):
net/mlx5e: Fix possible use-after-free deleting fdb rule
Wentao_Liang (1):
net/mlx5: DR, fix a potential use-after-free bug
drivers/net/ethernet/mellanox/mlx5/core/dev.c | 2 +-
.../net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 4 ++--
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 18 ++++++++++++++++++
.../net/ethernet/mellanox/mlx5/core/esw/indir_table.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/lag.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c | 8 ++++++++
drivers/net/ethernet/mellanox/mlx5/core/lag_mp.h | 2 ++
.../net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
8 files changed, 34 insertions(+), 4 deletions(-)
From: Dima Chumak <redacted>
When handling FIB_EVENT_ENTRY_REPLACE event for a new multipath route,
lag activation can be missed if a stale (struct lag_mp)->mfi pointer
exists, which was associated with an older multipath route that had been
removed.
Normally, when a route is removed, it triggers mlx5_lag_fib_event(),
which handles FIB_EVENT_ENTRY_DEL and clears mfi pointer. But, if
mlx5_lag_check_prereq() condition isn't met, for example when eswitch is
in legacy mode, the fib event is skipped and mfi pointer becomes stale.
Fix by resetting mfi pointer to NULL in mlx5_deactivate_lag().
Fixes: 8a66e4585979 ("net/mlx5: Change ownership model for lag")
Signed-off-by: Dima Chumak <redacted>
Reviewed-by: Roi Dayan <redacted>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/lag.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c | 8 ++++++++
drivers/net/ethernet/mellanox/mlx5/core/lag_mp.h | 2 ++
3 files changed, 11 insertions(+)
@@ -302,6 +302,14 @@ static int mlx5_lag_fib_event(struct notifier_block *nb,returnNOTIFY_DONE;}+voidmlx5_lag_mp_reset(structmlx5_lag*ldev)+{+/* Clear mfi, as it might become stale when a route delete event+*hasbeenmissed,seemlx5_lag_fib_route_event().+*/+ldev->lag_mp.mfi=NULL;+}+intmlx5_lag_mp_init(structmlx5_lag*ldev){structlag_mp*mp=&ldev->lag_mp;
From: Leon Romanovsky <leonro@nvidia.com>
The call to mlx5_unregister_device() means that mlx5_core driver is
removed. In such scenario, we need to disregard all other flags like
attach/detach and forcibly remove all auxiliary devices.
Fixes: a5ae8fc9058e ("net/mlx5e: Don't create devices during unload flow")
Tested-and-Reported-by: Yicong Yang [off-list ref]
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Roi Dayan <redacted>
After neigh-update-add failure we are still with a slow path rule but
the driver always assume the rule is an fdb rule.
Fix neigh-update-del by checking slow path tc flag on the flow.
Also fix neigh-update-add for when neigh-update-del fails the same.
Fixes: 5dbe906ff1d5 ("net/mlx5e: Use a slow path rule instead if vxlan neighbour isn't available")
Signed-off-by: Roi Dayan <redacted>
Reviewed-by: Paul Blakey <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Maor Dickman <redacted>
When indirect forward group is created, flow is added with vhca id but
without setting vhca id valid flag which violates the PRM.
Fix by setting the missing flag, vhca id valid.
Fixes: 34ca65352ddf ("net/mlx5: E-Switch, Indirect table infrastructure")
Signed-off-by: Maor Dickman <redacted>
Reviewed-by: Roi Dayan <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c | 1 +
1 file changed, 1 insertion(+)
From: Dmytro Linkin <redacted>
If link aggregation is used within stack devices driver rejects encap
rules if PF of the VF tunnel device is down. This happens because route
resolved for other PF and its eswitch instance is used to determine
correct vport.
To fix that use devcom feature to retrieve other eswitch instance if
failed to find vport for the 1st eswitch and LAG is active.
Fixes: 10742efc20a4 ("net/mlx5e: VF tunnel TX traffic offloading")
Signed-off-by: Dmytro Linkin <redacted>
Reviewed-by: Roi Dayan <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_tc.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -1349,7 +1350,24 @@ int mlx5e_tc_query_route_vport(struct net_device *out_dev, struct net_device *roroute_mdev=route_priv->mdev;vhca_id=MLX5_CAP_GEN(route_mdev,vhca_id);+if(mlx5_lag_is_active(out_priv->mdev)){+/* In lag case we may get devices from different eswitch instances.+*Ifwefailedtogetvportnum,itmeans,mostly,thatweonthewrong+*eswitch.+*/+err=mlx5_eswitch_vhca_id_to_vport(esw,vhca_id,vport);+if(err!=-ENOENT)+returnerr;++devcom=out_priv->mdev->priv.devcom;+esw=mlx5_devcom_get_peer_data(devcom,MLX5_DEVCOM_ESW_OFFLOADS);+if(!esw)+return-ENODEV;+}+err=mlx5_eswitch_vhca_id_to_vport(esw,vhca_id,vport);+if(devcom)+mlx5_devcom_release_peer_data(devcom,MLX5_DEVCOM_ESW_OFFLOADS);returnerr;}
From: Wentao_Liang <redacted>
In line 849 (#1), "mlx5dr_htbl_put(cur_htbl);" drops the reference to
cur_htbl and may cause cur_htbl to be freed.
However, cur_htbl is subsequently used in the next line, which may result
in an use-after-free bug.
Fix this by calling mlx5dr_err() before the cur_htbl is put.
Signed-off-by: Wentao_Liang <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Hello:
This series was applied to netdev/net.git (refs/heads/master):
On Thu, 26 Aug 2021 15:18:05 -0700 you wrote:
From: Dima Chumak <redacted>
When handling FIB_EVENT_ENTRY_REPLACE event for a new multipath route,
lag activation can be missed if a stale (struct lag_mp)->mfi pointer
exists, which was associated with an older multipath route that had been
removed.
[...]