Skip to content
Commit fd330713 authored by Vlad Buslov's avatar Vlad Buslov Committed by Saeed Mahameed
Browse files

net/mlx5: Take fs_counters dellist before addlist



In fs_counters elements from both addlist and dellist are removed by
mlx5_fc_stats_work() without any locking. This introduces race condition
when batch of new rules is created and then immediately deleted (for
example, when error occurred during flow creation). In such case some of
the rules might be in dellist, but not in addlist when mlx5_fc_stats_work()
is executed concurrently with tc, which will result rule deletion and
use-after-free on next iteration because deleted rules are still in
addlist.

Always take dellist first to guarantee that rules can only be deleted after
they were removed from addlist.

Fixes: 6e5e2283 ("net/mlx5: Add new list to store deleted flow counters")
Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
Reported-by: default avatarChris Mi <chrism@mellanox.com>
Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
parent 4972e6fa
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment