patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/1] net/mlx5: fix memory leak when releasing a drop action
@ 2022-07-30 10:40 Yunjian Wang
  2022-07-31  7:02 ` Matan Azrad
  0 siblings, 1 reply; 3+ messages in thread
From: Yunjian Wang @ 2022-07-30 10:40 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo, dkozlyuk, huangshaozhang, Yunjian Wang, stable

When the memory for hrxq->action is allocated in mlx5_devx_hrxq_new().
But it was not being freed when the drop action was released in
mlx5_devx_drop_action_destroy(). These cause a memory leak.

Fixes: bc5bee028ebc ("net/mlx5: create drop queue using DevX")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/mlx5/mlx5_devx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 6886ae1f22..171ce5c08a 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -1097,6 +1097,12 @@ mlx5_devx_drop_action_destroy(struct rte_eth_dev *dev)
 		mlx5_devx_ind_table_destroy(hrxq->ind_table);
 	if (priv->drop_queue.rxq->devx_rq.rq != NULL)
 		mlx5_rxq_devx_obj_drop_release(dev);
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+	if (hrxq->action != NULL) {
+		mlx5_glue->destroy_flow_action(hrxq->action);
+		hrxq->action = NULL;
+	}
+#endif
 }
 
 /**
-- 
2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [dpdk-dev] [PATCH 1/1] net/mlx5: fix memory leak when releasing a drop action
  2022-07-30 10:40 [dpdk-dev] [PATCH 1/1] net/mlx5: fix memory leak when releasing a drop action Yunjian Wang
@ 2022-07-31  7:02 ` Matan Azrad
  2022-08-03 13:23   ` wangyunjian
  0 siblings, 1 reply; 3+ messages in thread
From: Matan Azrad @ 2022-07-31  7:02 UTC (permalink / raw)
  To: Yunjian Wang, dev; +Cc: Slava Ovsiienko, Dmitry Kozlyuk, huangshaozhang, stable

Hi Yunjian

From: Yunjian Wang
> When the memory for hrxq->action is allocated in mlx5_devx_hrxq_new().

Memory -> resources .. are

> But it was not being freed when the drop action was released in
> mlx5_devx_drop_action_destroy(). These cause a memory leak.
> 
> Fixes: bc5bee028ebc ("net/mlx5: create drop queue using DevX")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/net/mlx5/mlx5_devx.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
> index 6886ae1f22..171ce5c08a 100644
> --- a/drivers/net/mlx5/mlx5_devx.c
> +++ b/drivers/net/mlx5/mlx5_devx.c
> @@ -1097,6 +1097,12 @@ mlx5_devx_drop_action_destroy(struct
> rte_eth_dev *dev)
>                 mlx5_devx_ind_table_destroy(hrxq->ind_table);
>         if (priv->drop_queue.rxq->devx_rq.rq != NULL)
>                 mlx5_rxq_devx_obj_drop_release(dev);
> +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> +       if (hrxq->action != NULL) {
> +               mlx5_glue->destroy_flow_action(hrxq->action);
> +               hrxq->action = NULL;
> +       }
> +#endif

Good catch for the leak.
I think the issue is in mlx5_devx_tir_destroy and not related only to the drop queue management.
So the fix should be for the mlx5_devx_tir_destroy. What do you think?



>  }
> 
>  /**
> --
> 2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [dpdk-dev] [PATCH 1/1] net/mlx5: fix memory leak when releasing a drop action
  2022-07-31  7:02 ` Matan Azrad
@ 2022-08-03 13:23   ` wangyunjian
  0 siblings, 0 replies; 3+ messages in thread
From: wangyunjian @ 2022-08-03 13:23 UTC (permalink / raw)
  To: Matan Azrad, dev; +Cc: Slava Ovsiienko, Dmitry Kozlyuk, Huangshaozhang, stable



> -----Original Message-----
> From: Matan Azrad [mailto:matan@nvidia.com]
> Sent: Sunday, July 31, 2022 3:02 PM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: Slava Ovsiienko <viacheslavo@nvidia.com>; Dmitry Kozlyuk
> <dkozlyuk@nvidia.com>; Huangshaozhang <huangshaozhang@huawei.com>;
> stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH 1/1] net/mlx5: fix memory leak when releasing a
> drop action
> 
> Hi Yunjian
> 
> From: Yunjian Wang
> > When the memory for hrxq->action is allocated in mlx5_devx_hrxq_new().
> 
> Memory -> resources .. are
> 
> > But it was not being freed when the drop action was released in
> > mlx5_devx_drop_action_destroy(). These cause a memory leak.
> >
> > Fixes: bc5bee028ebc ("net/mlx5: create drop queue using DevX")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > ---
> >  drivers/net/mlx5/mlx5_devx.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/net/mlx5/mlx5_devx.c
> > b/drivers/net/mlx5/mlx5_devx.c index 6886ae1f22..171ce5c08a 100644
> > --- a/drivers/net/mlx5/mlx5_devx.c
> > +++ b/drivers/net/mlx5/mlx5_devx.c
> > @@ -1097,6 +1097,12 @@ mlx5_devx_drop_action_destroy(struct
> > rte_eth_dev *dev)
> >                 mlx5_devx_ind_table_destroy(hrxq->ind_table);
> >         if (priv->drop_queue.rxq->devx_rq.rq != NULL)
> >                 mlx5_rxq_devx_obj_drop_release(dev);
> > +#ifdef HAVE_IBV_FLOW_DV_SUPPORT
> > +       if (hrxq->action != NULL) {
> > +               mlx5_glue->destroy_flow_action(hrxq->action);
> > +               hrxq->action = NULL;
> > +       }
> > +#endif
> 
> Good catch for the leak.
> I think the issue is in mlx5_devx_tir_destroy and not related only to the drop
> queue management.
> So the fix should be for the mlx5_devx_tir_destroy. What do you think?

Agree, I fix it. 
https://patchwork.dpdk.org/project/dpdk/patch/ba20dc6b94576f29cd2c9aa10672c700b20ce819.1659526016.git.wangyunjian@huawei.com/

Thanks.
> 
> 
> 
> >  }
> >
> >  /**
> > --
> > 2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-03 13:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-30 10:40 [dpdk-dev] [PATCH 1/1] net/mlx5: fix memory leak when releasing a drop action Yunjian Wang
2022-07-31  7:02 ` Matan Azrad
2022-08-03 13:23   ` wangyunjian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).