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: NVlad Buslov <vladbu@mellanox.com> Reported-by: NChris Mi <chrism@mellanox.com> Reviewed-by: NRoi Dayan <roid@mellanox.com>
Showing
想要评论请 注册 或 登录