summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_txq.c
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2019-05-20 11:07:26 +0300
committerFerruh Yigit <ferruh.yigit@intel.com>2019-05-27 10:21:04 +0200
commit9e444764487748d28adb9b57e75452ea8c3c9945 (patch)
tree5a1530f8ebfa2928bcc432e4d8dd26559744f339 /drivers/net/mlx5/mlx5_txq.c
parent73f008334ff427ec6ff680600bcf3ebb57459752 (diff)
downloaddpdk-next-eventdev-9e444764487748d28adb9b57e75452ea8c3c9945.zip
dpdk-next-eventdev-9e444764487748d28adb9b57e75452ea8c3c9945.tar.gz
dpdk-next-eventdev-9e444764487748d28adb9b57e75452ea8c3c9945.tar.xz
net/mlx5: fix memory free on queue create error
In function mlx5_rxq_ibv_new(), pointer *tmpl allocation is attempted at the start, but not validated or freed in case of error. In function mlx5_txq_ibv_new(), pointer *txq_ibv allocation is attempted at the start, but not freed in case of error. This patch adds pointers initialization, validation and freeing. Fixes: 09cb5b581762 ("net/mlx5: separate DPDK from verbs Rx queue objects") Fixes: faf2667fe8d5 ("net/mlx5: separate DPDK from verbs Tx queue objects") Cc: stable@dpdk.org Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_txq.c')
-rw-r--r--drivers/net/mlx5/mlx5_txq.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 50b1f81..289024c 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -401,7 +401,7 @@ mlx5_txq_ibv_new(struct rte_eth_dev *dev, uint16_t idx)
struct mlx5_txq_ctrl *txq_ctrl =
container_of(txq_data, struct mlx5_txq_ctrl, txq);
struct mlx5_txq_ibv tmpl;
- struct mlx5_txq_ibv *txq_ibv;
+ struct mlx5_txq_ibv *txq_ibv = NULL;
union {
struct ibv_qp_init_attr_ex init;
struct ibv_cq_init_attr_ex cq;
@@ -586,6 +586,8 @@ error:
claim_zero(mlx5_glue->destroy_cq(tmpl.cq));
if (tmpl.qp)
claim_zero(mlx5_glue->destroy_qp(tmpl.qp));
+ if (txq_ibv)
+ rte_free(txq_ibv);
priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_NONE;
rte_errno = ret; /* Restore rte_errno. */
return NULL;