DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix memleak for resource object
@ 2024-06-23 10:35 Mahmoud Maatuq
  2024-06-24 13:59 ` Dariusz Sosnowski
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Mahmoud Maatuq @ 2024-06-23 10:35 UTC (permalink / raw)
  To: Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
	Suanming Mou, Matan Azrad
  Cc: dev, Mahmoud Maatuq

Coverity issue: 426424
Fixes: e78e5408da89 ("net/mlx5: remove cache term from the list utility")
Cc: matan@nvidia.com

Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d46beffd4c..1010b8e423 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void *cb_ctx)
 		items = *((const struct rte_flow_item **)(ctx->data2));
 		resource->matcher_object = mlx5dr_bwc_matcher_create
 				(resource->group->tbl, resource->priority, items);
-		if (!(resource->matcher_object))
+		if (!(resource->matcher_object)) {
+			mlx5_free(resource);
 			return NULL;
+		}
 #else
+		mlx5_free(resource);
 		return NULL;
 #endif
 	}
-- 
2.43.0


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

* RE: [PATCH] net/mlx5: fix memleak for resource object
  2024-06-23 10:35 [PATCH] net/mlx5: fix memleak for resource object Mahmoud Maatuq
@ 2024-06-24 13:59 ` Dariusz Sosnowski
  2024-06-24 19:10   ` Mahmoud Maatouq
  2024-06-24 19:41 ` [PATCH v2] " Mahmoud Maatuq
  2024-07-02 20:14 ` [PATCH v3] net/mlx5: fix matcher object memory leak Mahmoud Maatuq
  2 siblings, 1 reply; 10+ messages in thread
From: Dariusz Sosnowski @ 2024-06-24 13:59 UTC (permalink / raw)
  To: Mahmoud Maatuq, Slava Ovsiienko, Bing Zhao, Ori Kam,
	Suanming Mou, Matan Azrad
  Cc: dev

Hi,

Thank you very much for the fix.

Could you please provide the commit message explaining the problem reported by Coverity and the fix?

> -----Original Message-----
> From: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> Sent: Sunday, June 23, 2024 12:36
> To: Dariusz Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan Azrad
> <matan@nvidia.com>
> Cc: dev@dpdk.org; Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> Subject: [PATCH] net/mlx5: fix memleak for resource object
> 
> Coverity issue: 426424
> Fixes: e78e5408da89 ("net/mlx5: remove cache term from the list utility")

The issue was introduced in commit 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure").
Fixes tag should reference that commit.

> Cc: matan@nvidia.com
> 
> Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index d46beffd4c..1010b8e423 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void
> *cb_ctx)
>                 items = *((const struct rte_flow_item **)(ctx->data2));
>                 resource->matcher_object = mlx5dr_bwc_matcher_create
>                                 (resource->group->tbl, resource->priority, items);
> -               if (!(resource->matcher_object))
> +               if (!(resource->matcher_object)) {

While we're at it, could you please remove the parentheses around resource->matcher_object? They're redundant.

> +                       mlx5_free(resource);
>                         return NULL;
> +               }
>  #else
> +               mlx5_free(resource);
>                 return NULL;
>  #endif
>         }
> --
> 2.43.0

Best regards,
Dariusz Sosnowski


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

* Re: [PATCH] net/mlx5: fix memleak for resource object
  2024-06-24 13:59 ` Dariusz Sosnowski
@ 2024-06-24 19:10   ` Mahmoud Maatouq
  2024-07-01 18:04     ` Dariusz Sosnowski
  0 siblings, 1 reply; 10+ messages in thread
From: Mahmoud Maatouq @ 2024-06-24 19:10 UTC (permalink / raw)
  To: Dariusz Sosnowski
  Cc: Slava Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, dev

On 06/24, Dariusz Sosnowski wrote:

> Hi,
>
> Thank you very much for the fix.
>
> Could you please provide the commit message explaining the problem reported by Coverity and the fix?

I thought of doing that, but found Coverity report already explained it,
so i was afraid it could be redundant, but I'll add it as a quick
explanation

>
> > -----Original Message-----
> > From: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > Sent: Sunday, June 23, 2024 12:36
> > To: Dariusz Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> > <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> > <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan Azrad
> > <matan@nvidia.com>
> > Cc: dev@dpdk.org; Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > Subject: [PATCH] net/mlx5: fix memleak for resource object
> >
> > Coverity issue: 426424
> > Fixes: e78e5408da89 ("net/mlx5: remove cache term from the list utility")
>
> The issue was introduced in commit 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure").
> Fixes tag should reference that commit.

how to get the proper commit that introduced the issue, as I used git
blame to get the above mentioned commit


>
> > Cc: matan@nvidia.com
> >
> > Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > ---
> >  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> > index d46beffd4c..1010b8e423 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void
> > *cb_ctx)
> >                 items = *((const struct rte_flow_item **)(ctx->data2));
> >                 resource->matcher_object = mlx5dr_bwc_matcher_create
> >                                 (resource->group->tbl, resource->priority, items);
> > -               if (!(resource->matcher_object))
> > +               if (!(resource->matcher_object)) {
>
> While we're at it, could you please remove the parentheses around resource->matcher_object? They're redundant.
>
> > +                       mlx5_free(resource);
> >                         return NULL;
> > +               }
> >  #else
> > +               mlx5_free(resource);
> >                 return NULL;
> >  #endif
> >         }
> > --
> > 2.43.0
>
> Best regards,
> Dariusz Sosnowski
>

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

* [PATCH v2] net/mlx5: fix memleak for resource object
  2024-06-23 10:35 [PATCH] net/mlx5: fix memleak for resource object Mahmoud Maatuq
  2024-06-24 13:59 ` Dariusz Sosnowski
@ 2024-06-24 19:41 ` Mahmoud Maatuq
  2024-07-01 18:07   ` Dariusz Sosnowski
  2024-07-02 20:14 ` [PATCH v3] net/mlx5: fix matcher object memory leak Mahmoud Maatuq
  2 siblings, 1 reply; 10+ messages in thread
From: Mahmoud Maatuq @ 2024-06-24 19:41 UTC (permalink / raw)
  To: Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
	Suanming Mou, Matan Azrad, Maayan Kashani
  Cc: dev, Mahmoud Maatuq

this makes sure that the allocated resource object is freed
for all branches that return NULL

Coverity issue: 426424
Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure")
Cc: mkashani@nvidia.com

Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d46beffd4c..8a0d58cb05 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void *cb_ctx)
 		items = *((const struct rte_flow_item **)(ctx->data2));
 		resource->matcher_object = mlx5dr_bwc_matcher_create
 				(resource->group->tbl, resource->priority, items);
-		if (!(resource->matcher_object))
+		if (!resource->matcher_object) {
+			mlx5_free(resource);
 			return NULL;
+		}
 #else
+		mlx5_free(resource);
 		return NULL;
 #endif
 	}
-- 
2.43.0


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

* RE: [PATCH] net/mlx5: fix memleak for resource object
  2024-06-24 19:10   ` Mahmoud Maatouq
@ 2024-07-01 18:04     ` Dariusz Sosnowski
  0 siblings, 0 replies; 10+ messages in thread
From: Dariusz Sosnowski @ 2024-07-01 18:04 UTC (permalink / raw)
  To: Mahmoud Maatouq
  Cc: Slava Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou, Matan Azrad, dev

> -----Original Message-----
> From: Mahmoud Maatouq <mahmoudmatook.mm@gmail.com>
> Sent: Monday, June 24, 2024 21:10
> To: Dariusz Sosnowski <dsosnowski@nvidia.com>
> Cc: Slava Ovsiienko <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>;
> Ori Kam <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; dev@dpdk.org
> Subject: Re: [PATCH] net/mlx5: fix memleak for resource object
> 
> On 06/24, Dariusz Sosnowski wrote:
> 
> > Hi,
> >
> > Thank you very much for the fix.
> >
> > Could you please provide the commit message explaining the problem reported
> by Coverity and the fix?
> 
> I thought of doing that, but found Coverity report already explained it, so i was
> afraid it could be redundant, but I'll add it as a quick explanation

Thank you. I'll review v2.

> >
> > > -----Original Message-----
> > > From: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > > Sent: Sunday, June 23, 2024 12:36
> > > To: Dariusz Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> > > <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> > > <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan
> Azrad
> > > <matan@nvidia.com>
> > > Cc: dev@dpdk.org; Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > > Subject: [PATCH] net/mlx5: fix memleak for resource object
> > >
> > > Coverity issue: 426424
> > > Fixes: e78e5408da89 ("net/mlx5: remove cache term from the list
> > > utility")
> >
> > The issue was introduced in commit 27d171b88031 ("net/mlx5: abstract flow
> action and enable reconfigure").
> > Fixes tag should reference that commit.
> 
> how to get the proper commit that introduced the issue, as I used git blame to get
> the above mentioned commit

I'd say that git blame for the code with the bug is a starting point.
The suspected commit (according to line number) should be verified if it really introduced the issue.
For example, in this patch:
- commit e78e5408da89 - modified the API for mlx5 list.
  It modified flow_dv_matcher_create_cb function but did not introduce the "if" with missing resource release.
- commit 27d171b88031 - introduced additional resource allocation and clean up was not covered in all code paths.

> 
> >
> > > Cc: matan@nvidia.com
> > >
> > > Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > > ---
> > >  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > > b/drivers/net/mlx5/mlx5_flow_dv.c index d46beffd4c..1010b8e423
> > > 100644
> > > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > > @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void
> > > *cb_ctx)
> > >                 items = *((const struct rte_flow_item **)(ctx->data2));
> > >                 resource->matcher_object = mlx5dr_bwc_matcher_create
> > >                                 (resource->group->tbl, resource->priority, items);
> > > -               if (!(resource->matcher_object))
> > > +               if (!(resource->matcher_object)) {
> >
> > While we're at it, could you please remove the parentheses around resource-
> >matcher_object? They're redundant.
> >
> > > +                       mlx5_free(resource);
> > >                         return NULL;
> > > +               }
> > >  #else
> > > +               mlx5_free(resource);
> > >                 return NULL;
> > >  #endif
> > >         }
> > > --
> > > 2.43.0
> >
> > Best regards,
> > Dariusz Sosnowski
> >

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

* RE: [PATCH v2] net/mlx5: fix memleak for resource object
  2024-06-24 19:41 ` [PATCH v2] " Mahmoud Maatuq
@ 2024-07-01 18:07   ` Dariusz Sosnowski
  0 siblings, 0 replies; 10+ messages in thread
From: Dariusz Sosnowski @ 2024-07-01 18:07 UTC (permalink / raw)
  To: Mahmoud Maatuq, Slava Ovsiienko, Bing Zhao, Ori Kam,
	Suanming Mou, Matan Azrad, Maayan Kashani
  Cc: dev

Hi,

Sorry for the delayed review. Just two small comments.

> -----Original Message-----
> From: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> Sent: Monday, June 24, 2024 21:42
> To: Dariusz Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Maayan Kashani <mkashani@nvidia.com>
> Cc: dev@dpdk.org; Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> Subject: [PATCH v2] net/mlx5: fix memleak for resource object 

I think for clarity what resource was leaking, a better title would be:
    net/mlx5: fix matcher object memory leak

> 
> this makes sure that the allocated resource object is freed for all branches that
> return NULL

Typo: s/this/This/
Also, s/allocated resource object/allocated matcher object/
Also, please add a period at the end of the sentence.

> Coverity issue: 426424
> Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure")
> Cc: mkashani@nvidia.com
> 
> Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index d46beffd4c..8a0d58cb05 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void
> *cb_ctx)
>                 items = *((const struct rte_flow_item **)(ctx->data2));
>                 resource->matcher_object = mlx5dr_bwc_matcher_create
>                                 (resource->group->tbl, resource->priority, items);
> -               if (!(resource->matcher_object))
> +               if (!resource->matcher_object) {
> +                       mlx5_free(resource);
>                         return NULL;
> +               }
>  #else
> +               mlx5_free(resource);
>                 return NULL;
>  #endif
>         }
> --
> 2.43.0

Best regards,
Dariusz Sosnowski


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

* [PATCH v3] net/mlx5: fix matcher object memory leak
  2024-06-23 10:35 [PATCH] net/mlx5: fix memleak for resource object Mahmoud Maatuq
  2024-06-24 13:59 ` Dariusz Sosnowski
  2024-06-24 19:41 ` [PATCH v2] " Mahmoud Maatuq
@ 2024-07-02 20:14 ` Mahmoud Maatuq
  2024-07-03  8:00   ` Bing Zhao
  2024-07-04 10:34   ` Raslan Darawsheh
  2 siblings, 2 replies; 10+ messages in thread
From: Mahmoud Maatuq @ 2024-07-02 20:14 UTC (permalink / raw)
  To: Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
	Suanming Mou, Matan Azrad, Maayan Kashani
  Cc: dev, Mahmoud Maatuq

This makes sure that the allocated matcher object is freed
for all branches that return NULL.

Coverity issue: 426424
Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure")
Cc: mkashani@nvidia.com

Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
---
v3:
* changed commit message.
* fixed typos
v2:
* fixed Fixes and Cc tags.
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index d46beffd4c..8a0d58cb05 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void *cb_ctx)
 		items = *((const struct rte_flow_item **)(ctx->data2));
 		resource->matcher_object = mlx5dr_bwc_matcher_create
 				(resource->group->tbl, resource->priority, items);
-		if (!(resource->matcher_object))
+		if (!resource->matcher_object) {
+			mlx5_free(resource);
 			return NULL;
+		}
 #else
+		mlx5_free(resource);
 		return NULL;
 #endif
 	}
--
2.43.0


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

* RE: [PATCH v3] net/mlx5: fix matcher object memory leak
  2024-07-02 20:14 ` [PATCH v3] net/mlx5: fix matcher object memory leak Mahmoud Maatuq
@ 2024-07-03  8:00   ` Bing Zhao
  2024-07-03  8:08     ` Dariusz Sosnowski
  2024-07-04 10:34   ` Raslan Darawsheh
  1 sibling, 1 reply; 10+ messages in thread
From: Bing Zhao @ 2024-07-03  8:00 UTC (permalink / raw)
  To: Mahmoud Maatuq, Dariusz Sosnowski, Slava Ovsiienko, Ori Kam,
	Suanming Mou, Matan Azrad, Maayan Kashani
  Cc: dev

Hi,


> -----Original Message-----
> From: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> Sent: Wednesday, July 3, 2024 4:15 AM
> To: Dariusz Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Maayan Kashani <mkashani@nvidia.com>
> Cc: dev@dpdk.org; Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> Subject: [PATCH v3] net/mlx5: fix matcher object memory leak
> 
> External email: Use caution opening links or attachments
> 
> 
> This makes sure that the allocated matcher object is freed for all
> branches that return NULL.
> 
> Coverity issue: 426424
> Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable
> reconfigure")
> Cc: mkashani@nvidia.com
> 
> Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> ---
> v3:
> * changed commit message.
> * fixed typos
> v2:
> * fixed Fixes and Cc tags.
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index d46beffd4c..8a0d58cb05 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void
> *cb_ctx)
>                 items = *((const struct rte_flow_item **)(ctx->data2));
>                 resource->matcher_object = mlx5dr_bwc_matcher_create
>                                 (resource->group->tbl, resource->priority,
> items);
> -               if (!(resource->matcher_object))
> +               if (!resource->matcher_object) {
> +                       mlx5_free(resource);
>                         return NULL;
> +               }
>  #else
> +               mlx5_free(resource);
>                 return NULL;
>  #endif
>         }
> --
> 2.43.0

Acked-by: Bing Zhao <bingz@nvidia.com>

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

* RE: [PATCH v3] net/mlx5: fix matcher object memory leak
  2024-07-03  8:00   ` Bing Zhao
@ 2024-07-03  8:08     ` Dariusz Sosnowski
  0 siblings, 0 replies; 10+ messages in thread
From: Dariusz Sosnowski @ 2024-07-03  8:08 UTC (permalink / raw)
  To: Bing Zhao, Mahmoud Maatuq, Slava Ovsiienko, Ori Kam,
	Suanming Mou, Matan Azrad, Maayan Kashani
  Cc: dev

Hi,

> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Wednesday, July 3, 2024 10:00
> To: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>; Dariusz
> Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; Suanming Mou
> <suanmingm@nvidia.com>; Matan Azrad <matan@nvidia.com>; Maayan
> Kashani <mkashani@nvidia.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v3] net/mlx5: fix matcher object memory leak
> 
> Hi,
> 
> 
> > -----Original Message-----
> > From: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > Sent: Wednesday, July 3, 2024 4:15 AM
> > To: Dariusz Sosnowski <dsosnowski@nvidia.com>; Slava Ovsiienko
> > <viacheslavo@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Ori Kam
> > <orika@nvidia.com>; Suanming Mou <suanmingm@nvidia.com>; Matan
> Azrad
> > <matan@nvidia.com>; Maayan Kashani <mkashani@nvidia.com>
> > Cc: dev@dpdk.org; Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > Subject: [PATCH v3] net/mlx5: fix matcher object memory leak
> >
> > External email: Use caution opening links or attachments
> >
> >
> > This makes sure that the allocated matcher object is freed for all
> > branches that return NULL.
> >
> > Coverity issue: 426424
> > Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable
> > reconfigure")
> > Cc: mkashani@nvidia.com
> >
> > Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> > ---
> > v3:
> > * changed commit message.
> > * fixed typos
> > v2:
> > * fixed Fixes and Cc tags.
> > ---
> >  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> > b/drivers/net/mlx5/mlx5_flow_dv.c index d46beffd4c..8a0d58cb05 100644
> > --- a/drivers/net/mlx5/mlx5_flow_dv.c
> > +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> > @@ -12010,9 +12010,12 @@ flow_matcher_create_cb(void *tool_ctx, void
> > *cb_ctx)
> >                 items = *((const struct rte_flow_item **)(ctx->data2));
> >                 resource->matcher_object = mlx5dr_bwc_matcher_create
> >                                 (resource->group->tbl,
> > resource->priority, items);
> > -               if (!(resource->matcher_object))
> > +               if (!resource->matcher_object) {
> > +                       mlx5_free(resource);
> >                         return NULL;
> > +               }
> >  #else
> > +               mlx5_free(resource);
> >                 return NULL;
> >  #endif
> >         }
> > --
> > 2.43.0
> 
> Acked-by: Bing Zhao <bingz@nvidia.com>

Thank you for all the changes and the patch!

Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>

Best regards,
Dariusz Sosnowski

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

* Re: [PATCH v3] net/mlx5: fix matcher object memory leak
  2024-07-02 20:14 ` [PATCH v3] net/mlx5: fix matcher object memory leak Mahmoud Maatuq
  2024-07-03  8:00   ` Bing Zhao
@ 2024-07-04 10:34   ` Raslan Darawsheh
  1 sibling, 0 replies; 10+ messages in thread
From: Raslan Darawsheh @ 2024-07-04 10:34 UTC (permalink / raw)
  To: Mahmoud Maatuq, Dariusz Sosnowski, Slava Ovsiienko, Bing Zhao,
	Ori Kam, Suanming Mou, Matan Azrad, Maayan Kashani
  Cc: dev

Hi,

From: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
Sent: Tuesday, July 2, 2024 11:14 PM
To: Dariusz Sosnowski; Slava Ovsiienko; Bing Zhao; Ori Kam; Suanming Mou; Matan Azrad; Maayan Kashani
Cc: dev@dpdk.org; Mahmoud Maatuq
Subject: [PATCH v3] net/mlx5: fix matcher object memory leak

This makes sure that the allocated matcher object is freed
for all branches that return NULL.

Coverity issue: 426424
Fixes: 27d171b88031 ("net/mlx5: abstract flow action and enable reconfigure")
Cc: mkashani@nvidia.com

Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


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

end of thread, other threads:[~2024-07-04 10:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-23 10:35 [PATCH] net/mlx5: fix memleak for resource object Mahmoud Maatuq
2024-06-24 13:59 ` Dariusz Sosnowski
2024-06-24 19:10   ` Mahmoud Maatouq
2024-07-01 18:04     ` Dariusz Sosnowski
2024-06-24 19:41 ` [PATCH v2] " Mahmoud Maatuq
2024-07-01 18:07   ` Dariusz Sosnowski
2024-07-02 20:14 ` [PATCH v3] net/mlx5: fix matcher object memory leak Mahmoud Maatuq
2024-07-03  8:00   ` Bing Zhao
2024-07-03  8:08     ` Dariusz Sosnowski
2024-07-04 10:34   ` Raslan Darawsheh

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).