Skip to content

Commit 4e25b66

Browse files
Jianbo LiuSaeed Mahameed
authored andcommitted
net/mlx5e: Check the number of elements before walk TC rhashtable
After IPSec TX tables are destroyed, the flow rules in TC rhashtable, which have the destination to IPSec, are restored to the original one, the uplink. However, when the device is in switchdev mode and unload driver with IPSec rules configured, TC rhashtable cleanup is done before IPSec cleanup, which means tc_ht->tbl is already freed when walking TC rhashtable, in order to restore the destination. So add the checking before walking to avoid unexpected behavior. Fixes: d156953 ("net/mlx5e: Modify and restore TC rules for IPSec TX rules") Signed-off-by: Jianbo Liu <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent baac835 commit 4e25b66

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/esw

1 file changed

+1
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/esw/ipsec_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev *mdev)
152152

153153
xa_for_each(&esw->offloads.vport_reps, i, rep) {
154154
rpriv = rep->rep_data[REP_ETH].priv;
155-
if (!rpriv || !rpriv->netdev)
155+
if (!rpriv || !rpriv->netdev || !atomic_read(&rpriv->tc_ht.nelems))
156156
continue;
157157

158158
rhashtable_walk_enter(&rpriv->tc_ht, &iter);

0 commit comments

Comments
 (0)