* [PATCH net] net/mlx5e: Release FIB event work flows before dropping RTNL
@ 2026-11-18 14:36 Tariq Toukan
0 siblings, 0 replies; only message in thread
From: Tariq Toukan @ 2026-11-18 14:36 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
netdev, Paolo Abeni
Cc: Dmytro Linkin, Fernando Fernandez Mancera, Gal Pressman,
Ido Schimmel, Jianbo Liu, Kuniyuki Iwashima, Leon Romanovsky,
open list, linux-rdma, Mark Bloch, Nikolay Aleksandrov,
Roi Dayan, Saeed Mahameed, Tariq Toukan, Vlad Buslov
From: Gal Pressman <gal@nvidia.com>
The FIB event work, neigh update work and the neigh stats work all use
flow->tmp_list to hold the encap flows they work on, while RTNL is what
keeps them from using it at the same time.
mlx5e_tc_fib_event_work() drops RTNL before it is done with its list.
A neigh work can then take the same flows while the FIB work is still
walking them, and the two overwrite each other's list.
Release the flow list before dropping RTNL.
The issue was hit once in our regression testing (OVS connection
tracking with the VXLAN endpoint on a VF, KASAN build):
BUG: KASAN: stack-out-of-bounds in mlx5e_flow_put+0x23/0x80 [mlx5_core]
Write of size 4 at addr ffff8881226d7b20 by task kworker/u40:1/20171
Workqueue: mlx5e mlx5e_tc_fib_event_work [mlx5_core]
Call Trace:
mlx5e_flow_put+0x23/0x80 [mlx5_core]
mlx5e_put_flow_list+0x82/0xe0 [mlx5_core]
mlx5e_tc_fib_event_work+0x704/0x1fb0 [mlx5_core]
process_one_work+0x8df/0x1660
The race was also reproduced with an msleep() inserted between
rtnl_unlock() and mlx5e_put_flow_list() to widen the window, a VXLAN
encap rule whose endpoint IP is on a VF, and route churn on the endpoint
address.
Fixes: 8914add2c9e5 ("net/mlx5e: Handle FIB events to update tunnel endpoint device")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
index 5e40107efa26..4f9f8beffbc8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c
@@ -1718,9 +1718,9 @@ static void mlx5e_tc_fib_event_work(struct work_struct *work)
r->flags |= MLX5E_ROUTE_ENTRY_VALID;
out:
mutex_unlock(&esw->offloads.encap_tbl_lock);
+ mlx5e_put_flow_list(priv, &flow_list);
rtnl_unlock();
- mlx5e_put_flow_list(priv, &flow_list);
mlx5e_route_put(priv, event_data->r);
dev_put(event_data->ul_dev);
kfree(event_data);
base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
--
2.44.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-18 14:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 14:36 [PATCH net] net/mlx5e: Release FIB event work flows before dropping RTNL Tariq Toukan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®