net/mlx5: fix leak on ASO age pools resize failure
authorMichael Baum <michaelba@nvidia.com>
Wed, 11 Nov 2020 07:36:46 +0000 (07:36 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sat, 14 Nov 2020 00:36:19 +0000 (01:36 +0100)
In ASO age pools resize, the PMD starts ASO data-path.

When starting ASO data-path is failed, the pools memory was not freed
what caused a memory leak.

Free it.

Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_flow_dv.c

index 666cad4..62d9ca9 100644 (file)
@@ -9347,8 +9347,10 @@ flow_dv_aso_age_pools_resize(struct rte_eth_dev *dev)
                /* First ASO flow hit allocation - starting ASO data-path. */
                int ret = mlx5_aso_queue_start(priv->sh);
 
-               if (ret)
+               if (ret) {
+                       mlx5_free(pools);
                        return ret;
+               }
        }
        mng->n = resize;
        mng->pools = pools;