From 64ed71d59a3ee98f0d2498d0fbdd9edd78662b89 Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Wed, 28 Oct 2020 06:58:06 +0200 Subject: [PATCH] net/mlx5: fix tunnel flow destroy 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. Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload") Signed-off-by: Gregory Etelson Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 28fd199208..f9420e7117 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -5888,8 +5888,6 @@ flow_list_destroy(struct rte_eth_dev *dev, uint32_t *list, flow_idx, flow, next); rte_spinlock_unlock(&priv->flow_list_lock); } - flow_mreg_del_copy_action(dev, flow); - mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_RTE_FLOW], flow_idx); if (flow->tunnel) { struct mlx5_flow_tunnel *tunnel; @@ -5901,6 +5899,8 @@ 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); } + flow_mreg_del_copy_action(dev, flow); + mlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_RTE_FLOW], flow_idx); } /** -- 2.20.1