When the allocated trunks are used out, the pool trunk array will be
grown to a larger size to save more trunks.

Currently, when replace the pool trunk array to the new one. The code
wrongly frees the new trunk array.

Should free the old trunk array to fix the bug.

Fixes: 1702f7848f6a ("net/mlx5: add indexed memory pool")

Signed-off-by: Suanming Mou <suanmi...@mellanox.com>
---
 drivers/net/mlx5/mlx5_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c
index 07a6283..2146ffd 100644
--- a/drivers/net/mlx5/mlx5_utils.c
+++ b/drivers/net/mlx5/mlx5_utils.c
@@ -251,7 +251,7 @@ struct mlx5_indexed_pool *
                trunk_tmp = pool->trunks;
                pool->trunks = p;
                if (trunk_tmp)
-                       pool->cfg.free(pool->trunks);
+                       pool->cfg.free(trunk_tmp);
                pool->n_trunk += n_grow;
        }
        if (!pool->cfg.release_mem_en) {
-- 
1.8.3.1

Reply via email to