]> git.droids-corp.org - dpdk.git/commitdiff
net/mlx5: fix Rx hash queue creation error flow
authorMichael Baum <michaelba@nvidia.com>
Thu, 3 Sep 2020 10:13:32 +0000 (10:13 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:08 +0000 (18:55 +0200)
The mlx5_hrxq_new function allocates several resources and if one of the
allocations fails, the function jumps to an error label where it
releases all the allocated resources.

When the TIR action creation fails, the hrxq memory is not released what
can cause a resource leak.

Add an appropriate release to the hrxq pointer in the error flow.

Fixes: 772dc0eb83d3 ("net/mlx5: convert hrxq to indexed")
Fixes: dc9ceff73c99 ("net/mlx5: create advanced RxQ via DevX")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_rxq.c

index 946f7454f65a0843ecff91ef482afc21117d5b87..0d1659292779ccb536cd1746259d44a8fc63d9dd 100644 (file)
@@ -2873,7 +2873,7 @@ mlx5_hrxq_new(struct rte_eth_dev *dev,
              int tunnel __rte_unused)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
-       struct mlx5_hrxq *hrxq;
+       struct mlx5_hrxq *hrxq = NULL;
        uint32_t hrxq_idx = 0;
        struct ibv_qp *qp = NULL;
        struct mlx5_ind_table_obj *ind_tbl;
@@ -3074,6 +3074,8 @@ error:
                claim_zero(mlx5_glue->destroy_qp(qp));
        else if (tir)
                claim_zero(mlx5_devx_cmd_destroy(tir));
+       if (hrxq)
+               mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_HRXQ], hrxq_idx);
        rte_errno = err; /* Restore rte_errno. */
        return 0;
 }