Skip to contentSkip to conversation

net/mlx5: E-Switch, Fix an Oops error handling code

PATCH In review Dan Carpenter 2 participants 2 messages Jun 3, 2020 – Jun 4, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: E-Switch, Fix an Oops error handling code

The error handling dereferences "vport". There is nothing we can do if it is an error pointer except returning the error code.

Fixes 133dcfc577ea ("net/mlx5: E-Switch, Alloc and free unique metadata for match")
---
 drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +1 -2
index 4e55d7225a265..857f6193f3b14 100644
@@ -301,8 +301,7 @@ int mlx5_esw_acl_ingress_vport_bond_update(struct mlx5_eswitch *esw, u16 vport_n
 
 	if (WARN_ON_ONCE(IS_ERR(vport))) {
 		esw_warn(esw->dev, "vport(%d) invalid!\n", vport_num);
-		err = PTR_ERR(vport);
-		goto out;
+		return PTR_ERR(vport);
 	}
 
 	esw_acl_ingress_ofld_rules_destroy(esw, vport);
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Dan Carpenter

The error handling dereferences "vport". There is nothing we can do if it is an error pointer except returning the error code.

Fixes 133dcfc577ea ("net/mlx5: E-Switch, Alloc and free unique metadata for match")
---
 drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +0 -0
index 4e55d7225a265..857f6193f3b14 100644

drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c int mlx5_esw_acl_ingress_vport_bond_update(struct mlx5_eswitch *esw, u16 vport_n · line 307

Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +1 -2
@@ -301,8 +301,7 @@ int mlx5_esw_acl_ingress_vport_bond_update(struct mlx5_eswitch *esw, u16 vport_n
 
 	if (WARN_ON_ONCE(IS_ERR(vport))) {
 		esw_warn(esw->dev, "vport(%d) invalid!\n", vport_num);
-		err = PTR_ERR(vport);
-		goto out;
+		return PTR_ERR(vport);
 	}
 
 	esw_acl_ingress_ofld_rules_destroy(esw, vport);

thanks!