Flow destructor tired to access flow related resources after the
flow object memory was already released and crashed dpdk process.

The patch moves flow memory release to the end of destructor.

Signed-off-by: Gregory Etelson <getel...@nvidia.com>
Acked-by: Matan Azrad <ma...@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 949b9ced9b..3128da1b47 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -5935,7 +5935,6 @@ flow_list_destroy(struct rte_eth_dev *dev, uint32_t *list,
                        mlx5_free(priv_fdir_flow);
                }
        }
-       mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_RTE_FLOW], flow_idx);
        if (flow->tunnel) {
                struct mlx5_flow_tunnel *tunnel;
                tunnel = mlx5_find_tunnel_id(dev, flow->tunnel_id);
@@ -5943,6 +5942,7 @@ flow_list_destroy(struct rte_eth_dev *dev, uint32_t *list,
                if (!__atomic_sub_fetch(&tunnel->refctn, 1, __ATOMIC_RELAXED))
                        mlx5_flow_tunnel_free(dev, tunnel);
        }
+       mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_RTE_FLOW], flow_idx);
 }
 
 /**
-- 
2.28.0

Reply via email to