From: Michael Baum Date: Wed, 6 May 2020 16:27:54 +0000 (+0000) Subject: net/mlx4: fix drop queue error handling X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6f155c0b9de5a58b5653d3e81c553564984f3c36;p=dpdk.git net/mlx4: fix drop queue error handling The function mlx4_drop_get() creates pointer to a struct mlx4_drop and if needed allocates by rte_malloc. If the allocation is failed the function goes to label “error”, and there does dereference to a null pointer. Skip resources cleaning when the memory allocation is failed. Coverity issue: 146206 Coverity issue: 146146 Fixes: d3a7e09234e4 ("net/mlx4: allocate drop flow resources on demand") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 793f0b090e..2a86382db7 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -980,12 +980,13 @@ mlx4_drop_get(struct mlx4_priv *priv) priv->drop = drop; return drop; error: - if (drop->qp) - claim_zero(mlx4_glue->destroy_qp(drop->qp)); - if (drop->cq) - claim_zero(mlx4_glue->destroy_cq(drop->cq)); - if (drop) + if (drop) { + if (drop->qp) + claim_zero(mlx4_glue->destroy_qp(drop->qp)); + if (drop->cq) + claim_zero(mlx4_glue->destroy_cq(drop->cq)); rte_free(drop); + } rte_errno = ENOMEM; return NULL; }