Re: [PATCH net] net/mlx5e: Hold sync_lock while resetting VXLAN ports

From: Tariq Toukan

Date: Wed Nov 18 2026 - 06:26:43 EST




On 13/11/2026 6:03, Changyul Lee wrote:
mlx5_vxlan_reset_to_default() walks vxlan->htable without sync_lock
and calls mlx5_vxlan_del_port() for each user port. mlx5e_nic_disable()
and mlx5e_uplink_rep_disable() call it after rtnl_unlock(), so the
udp_tunnel_nic work can run mlx5e_vxlan_unset_port() at the same time.
If that removes and frees the entry saved as the next one in
hash_for_each_safe(), the walk then reads freed memory.

Hold sync_lock over the whole walk, and add __mlx5_vxlan_del_port() for
callers that already hold it.

Fixes: c5eb51adf06b ("net/mlx5e: Fix VXLAN synchronization after function reload")
Signed-off-by: Changyul Lee <lcy8047@xxxxxxxxx>
---
Found with a static analysis tool we are developing.

Compile-tested only, with x86_64_defconfig plus MLX5_CORE_EN and W=1.

.../ethernet/mellanox/mlx5/core/lib/vxlan.c | 24 ++++++++++++-------
1 file changed, 15 insertions(+), 9 deletions(-)

Reviewed-by: Tariq Toukan <tariqt@xxxxxxxxxx>

Thanks.