diff mbox series

net/mlx5: Fix some error handling paths in 'mlx5e_tc_add_fdb_flow()'

Message ID 3055988affc39dff4d2a5c00a8d18474b0d63e26.1636218396.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series net/mlx5: Fix some error handling paths in 'mlx5e_tc_add_fdb_flow()' | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 37 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Christophe JAILLET Nov. 6, 2021, 5:08 p.m. UTC
All the error handling paths of 'mlx5e_tc_add_fdb_flow()' end to 'err_out'
where 'flow_flag_set(flow, FAILED);' is called.

All but the new error handling paths added by the commits given in the
Fixes tag below.

Fix these error handling paths and branch to 'err_out'.

Fixes: 166f431ec6be ("net/mlx5e: Add indirect tc offload of ovs internal port")
Fixes: b16eb3c81fe2 ("net/mlx5: Support internal port as decap route device")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is speculative, review with care.
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Roi Dayan Nov. 7, 2021, 7:49 a.m. UTC | #1
On 2021-11-06 7:08 PM, Christophe JAILLET wrote:
> All the error handling paths of 'mlx5e_tc_add_fdb_flow()' end to 'err_out'
> where 'flow_flag_set(flow, FAILED);' is called.
> 
> All but the new error handling paths added by the commits given in the
> Fixes tag below.
> 
> Fix these error handling paths and branch to 'err_out'.
> 
> Fixes: 166f431ec6be ("net/mlx5e: Add indirect tc offload of ovs internal port")
> Fixes: b16eb3c81fe2 ("net/mlx5: Support internal port as decap route device")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative, review with care.
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 835caa1c7b74..ff881307c744 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -1445,7 +1445,7 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
>   							MLX5_FLOW_NAMESPACE_FDB, VPORT_TO_REG,
>   							metadata);
>   			if (err)
> -				return err;
> +				goto err_out;
>   		}
>   	}
>   
> @@ -1461,13 +1461,15 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
>   		if (attr->chain) {
>   			NL_SET_ERR_MSG_MOD(extack,
>   					   "Internal port rule is only supported on chain 0");
> -			return -EOPNOTSUPP;
> +			err = -EOPNOTSUPP;
> +			goto err_out;
>   		}
>   
>   		if (attr->dest_chain) {
>   			NL_SET_ERR_MSG_MOD(extack,
>   					   "Internal port rule offload doesn't support goto action");
> -			return -EOPNOTSUPP;
> +			err = -EOPNOTSUPP;
> +			goto err_out;
>   		}
>   
>   		int_port = mlx5e_tc_int_port_get(mlx5e_get_int_port_priv(priv),
> @@ -1475,8 +1477,10 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
>   						 flow_flag_test(flow, EGRESS) ?
>   						 MLX5E_TC_INT_PORT_EGRESS :
>   						 MLX5E_TC_INT_PORT_INGRESS);
> -		if (IS_ERR(int_port))
> -			return PTR_ERR(int_port);
> +		if (IS_ERR(int_port)) {
> +			err = PTR_ERR(int_port);
> +			goto err_out;
> +		}
>   
>   		esw_attr->int_port = int_port;
>   	}
> 


thanks for catching this.

Reviewed-by: Roi Dayan <roid@nvidia.com>
Saeed Mahameed Nov. 16, 2021, 8:44 p.m. UTC | #2
On Sat, 2021-11-06 at 18:08 +0100, Christophe JAILLET wrote:
> All the error handling paths of 'mlx5e_tc_add_fdb_flow()' end to
> 'err_out'
> where 'flow_flag_set(flow, FAILED);' is called.
> 
> All but the new error handling paths added by the commits given in
> the
> Fixes tag below.
> 
> Fix these error handling paths and branch to 'err_out'.
> 
> Fixes: 166f431ec6be ("net/mlx5e: Add indirect tc offload of ovs
> internal port")
> Fixes: b16eb3c81fe2 ("net/mlx5: Support internal port as decap route
> device")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> This patch is speculative, review with care.
> ---

Applied to net-mlx5, Thanks !
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 835caa1c7b74..ff881307c744 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1445,7 +1445,7 @@  mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
 							MLX5_FLOW_NAMESPACE_FDB, VPORT_TO_REG,
 							metadata);
 			if (err)
-				return err;
+				goto err_out;
 		}
 	}
 
@@ -1461,13 +1461,15 @@  mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
 		if (attr->chain) {
 			NL_SET_ERR_MSG_MOD(extack,
 					   "Internal port rule is only supported on chain 0");
-			return -EOPNOTSUPP;
+			err = -EOPNOTSUPP;
+			goto err_out;
 		}
 
 		if (attr->dest_chain) {
 			NL_SET_ERR_MSG_MOD(extack,
 					   "Internal port rule offload doesn't support goto action");
-			return -EOPNOTSUPP;
+			err = -EOPNOTSUPP;
+			goto err_out;
 		}
 
 		int_port = mlx5e_tc_int_port_get(mlx5e_get_int_port_priv(priv),
@@ -1475,8 +1477,10 @@  mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
 						 flow_flag_test(flow, EGRESS) ?
 						 MLX5E_TC_INT_PORT_EGRESS :
 						 MLX5E_TC_INT_PORT_INGRESS);
-		if (IS_ERR(int_port))
-			return PTR_ERR(int_port);
+		if (IS_ERR(int_port)) {
+			err = PTR_ERR(int_port);
+			goto err_out;
+		}
 
 		esw_attr->int_port = int_port;
 	}