Skip to content

Commit

Permalink
net/mlx5: fix indexed pool local cache crash
Browse files Browse the repository at this point in the history
[ upstream commit 7869d60 ]

Local cache for an indexed pool is not initialized in the situation when
all the indices are allocated on one CPU core and freed on another one.
That leads to a crash once we try to check its reference counter.
Check that the local cache is initialized before accessing this counter.

Fixes: d15c094 ("net/mlx5: add indexed pool local cache")

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
aleks-kozyrev authored and kevintraynor committed Nov 23, 2022
1 parent 4cce54a commit 815d594
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/mlx5/mlx5_utils.c
Expand Up @@ -479,7 +479,7 @@ _mlx5_ipool_free_cache(struct mlx5_indexed_pool *pool, int cidx, uint32_t idx)
mlx5_ipool_lock(pool);
gc = pool->gc;
if (ilc->lc != gc) {
if (!(--ilc->lc->ref_cnt))
if (ilc->lc && !(--ilc->lc->ref_cnt))
olc = ilc->lc;
gc->ref_cnt++;
ilc->lc = gc;
Expand Down

0 comments on commit 815d594

Please sign in to comment.