aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShahar Klein <shahark@mellanox.com>2017-08-01 15:29:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-09-20 08:22:09 +0200
commit8db40bcf439f3939d16de824adc7a0d781390761 (patch)
treeb1cadca03083ec617b3a864bd85066c2adec44b9
parentnet/mlx5e: Properly resolve TC offloaded ipv6 vxlan tunnel source address (diff)
downloadlinux-stable-8db40bcf439f3939d16de824adc7a0d781390761.tar.xz
linux-stable-8db40bcf439f3939d16de824adc7a0d781390761.zip
net/mlx5: E-Switch, Unload the representors in the correct order
[ Upstream commit 191220396db840822fc818edf03c49f0c02eb237 ] When changing from switchdev to legacy mode, all the representor port devices (uplink nic and reps) are cleaned up. Part of this cleaning process is removing the neigh entries and the hash table containing them. However, a representor neigh entry might be linked to the uplink port hash table and if the uplink nic is cleaned first the cleaning of the representor will end up in null deref. Fix that by unloading the representors in the opposite order of load. Fixes: cb67b832921c ("net/mlx5e: Introduce SRIOV VF representors") Signed-off-by: Shahar Klein <shahark@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index a53e982a6863..f28750bb56d6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -818,7 +818,7 @@ void esw_offloads_cleanup(struct mlx5_eswitch *esw, int nvports)
struct mlx5_eswitch_rep *rep;
int vport;
- for (vport = 0; vport < nvports; vport++) {
+ for (vport = nvports - 1; vport >= 0; vport--) {
rep = &esw->offloads.vport_reps[vport];
if (!rep->valid)
continue;