regex/mlx5: fix RegEx probing error flow
PATCH 1/1 regex/mlx5: fix RegEx probing error flow
In RegEx device probing, there is register read trying after context device creation.
When the reading fails, the context device was not freed what caused a memory leak.
Free it.
--- drivers/regex/mlx5/mlx5_regex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regex/mlx5/mlx5_regex.c +1 -1
@@ -171,7 +171,7 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev) MLX5_RXP_CSR_IDENTIFIER, &val);if (ret) {DRV_LOG (ERR ,"CSR read failed!" ); -return -1 ; + goto dev_error; }if (val ==MLX5_RXP_BF2_IDENTIFIER ) priv->is_bf2 =1 ;
Signature · 1 line
2.25.1
From: Michael Baum
Quoted 6 lines
In RegEx device probing, there is register read trying after context device creation.
When the reading fails, the context device was not freed what caused a memory leak.
Quoted 6 lines
Free it.
Fixes f324162e8e77 ("regex/mlx5: support combined rule file")Signed-off-by Michael Baum <[email protected]>
Quoted 35 lines
-----Original Message-----
From: Michael Baum <[email protected]>In RegEx device probing, there is register read trying after context device creation.
When the reading fails, the context device was not freed what caused a memory leak.
Free it.
Fixes f324162e8e77 ("regex/mlx5: support combined rule file")Signed-off-by Michael Baum <[email protected]>--- drivers/regex/mlx5/mlx5_regex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/regex/mlx5/mlx5_regex.cindexf17b6df47f..8866a4d0c6100644drivers/regex/mlx5/mlx5_regex.c +1
-2@@ -171,7 +171,7 @@ mlx5_regex_dev_probe(struct rte_device *rte_dev) MLX5_RXP_CSR_IDENTIFIER, &val);if (ret) {DRV_LOG (ERR ,"CSR read failed!" ); -return -1 ; + goto dev_error; }if (val ==MLX5_RXP_BF2_IDENTIFIER ) priv->is_bf2 =1 ; --
Quoted 1 line
2.25.1
Thanks,
Thomas Monjalon
Applied01/09/2021 10:11, Ori Kam:
Quoted 10 lines
Quoted 10 lines
From: Michael Baum <[email protected]>
In RegEx device probing, there is register read trying after context device creation.
When the reading fails, the context device was not freed what caused a memory leak.
Free it.
Quoted 7 lines
Quoted 4 lines
Fixes f324162e8e77 ("regex/mlx5: support combined rule file")Signed-off-by Michael Baum <[email protected]>Thanks,
Acked-by Ori Kam <[email protected]>
Applied, thanks.
Title changed to:
regex/mlx5: fix leak after probing failure