diff mbox series

[v3,1/6] net/mlx5: flow counters object create function bugfix

Message ID 1539962470-10950-2-git-send-email-viacheslavo@mellanox.com (mailing list archive)
State Changes Requested, archived
Delegated to: Shahaf Shuler
Headers show
Series net/mlx5: flow counters support for Linux-rdma v19 | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Slava Ovsiienko Oct. 19, 2018, 3:21 p.m. UTC
The first part of patchset provides the separate commit for
bugfix. Flow counter object was not freed in case of memory
allocation error. The call of counter Verbs object deallocating
function is added. The initial value of reference counter is
set to one in order to provide the correct counter object
freeing in the flow_verbs_counter_release() function.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_verbs.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Shahaf Shuler Oct. 21, 2018, 9:20 a.m. UTC | #1
Friday, October 19, 2018 6:21 PM, Slava Ovsiienko:
> Subject: [PATCH v3 1/6] net/mlx5: flow counters object create function
> bugfix

How about: "net/mlx5: fix flow counter creation" ?

> 
> The first part of patchset provides the separate commit for bugfix. 

No need for this intro (exists on all patches). After the merge, in the git log no one knows what is a "patch series". 

Flow
> counter object was not freed in case of memory allocation error. The call of
> counter Verbs object deallocating function is added. The initial value of
> reference counter is set to one in order to provide the correct counter object
> freeing in the flow_verbs_counter_release() function.
> 

Missing Cc: stable
Also missing the commit which introduced the issue. On your case need to add:
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")

> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_verbs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 4ae974b..6ddb13b 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -72,6 +72,7 @@
>  			 }),
>  		.hits = 0,
>  		.bytes = 0,
> +		.ref_cnt = 1,
>  	};
> 
>  	if (!tmpl.cs) {
> @@ -80,6 +81,7 @@
>  	}
>  	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
>  	if (!cnt) {
> +		claim_zero(mlx5_glue->destroy_counter_set(tmpl.cs));
>  		rte_errno = ENOMEM;
>  		return NULL;
>  	}
> --
> 1.8.3.1
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 4ae974b..6ddb13b 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -72,6 +72,7 @@ 
 			 }),
 		.hits = 0,
 		.bytes = 0,
+		.ref_cnt = 1,
 	};
 
 	if (!tmpl.cs) {
@@ -80,6 +81,7 @@ 
 	}
 	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
 	if (!cnt) {
+		claim_zero(mlx5_glue->destroy_counter_set(tmpl.cs));
 		rte_errno = ENOMEM;
 		return NULL;
 	}