net/mlx5: fix leak on ASO SQ creation failure
authorMichael Baum <michaelba@nvidia.com>
Wed, 6 Jan 2021 08:19:25 +0000 (08:19 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 14 Jan 2021 09:12:36 +0000 (10:12 +0100)
In ASO SQ creation, the PMD allocates umem buffer for SQ.

When umem buffer allocation fails, the MR and CQ memory are not freed
what caused a memory leak.

Free it.

Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_flow_age.c

index 1f15f19..e867607 100644 (file)
@@ -279,7 +279,8 @@ mlx5_aso_sq_create(void *ctx, struct mlx5_aso_sq *sq, int socket,
                                   sizeof(*sq->db_rec) * 2, 4096, socket);
        if (!sq->umem_buf) {
                DRV_LOG(ERR, "Can't allocate wqe buffer.");
-               return -ENOMEM;
+               rte_errno = ENOMEM;
+               goto error;
        }
        sq->wqe_umem = mlx5_os_umem_reg(ctx,
                                                (void *)(uintptr_t)sq->umem_buf,