[2/2] net/mlx5: fix indexed pool incorrect trunks free

Message ID 1587350076-58468-3-git-send-email-suanmingm@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix indexed pool bugs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Suanming Mou April 20, 2020, 2:34 a.m. UTC
  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 <suanmingm@mellanox.com>
---
 drivers/net/mlx5/mlx5_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

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) {