diff mbox series

[RFC,01/21] net/mlx5: fix shared device context creation error flow

Message ID 20210817134441.1966618-2-michaelba@nvidia.com (mailing list archive)
State RFC, archived
Delegated to: Raslan Darawsheh
Headers show
Series mlx5: sharing global MR cache between drivers | expand


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Michael Baum Aug. 17, 2021, 1:44 p.m. UTC
In shared device context creation, there are two validations after MR
btree memory allocation.

When one of them fails, the MR btree memory was not freed what caused a
memory leak.

Free it.

Fixes: 632f0f19056f ("net/mlx5: manage shared counters in three-level table")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@nvidia.com>
 drivers/net/mlx5/mlx5.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index f84e061fe7..f0ec2d1279 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1254,6 +1254,8 @@  mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
 	if (sh->cnt_id_tbl)
+	if (sh->share_cache.cache.table)
+		mlx5_mr_btree_free(&sh->share_cache.cache);
 	if (sh->tis)
 	if (sh->td)