net/mlx5: E-Switch, Fix some error pointer dereferences
Subsystems (5)
PATCH 1/1 net/mlx5: E-Switch, Fix some error pointer dereferences
We can't leave "counter" set to an error pointer. Otherwise either it will lead to an error pointer dereference later in the function or it leads to an error pointer dereference when we call mlx5_fc_destroy().
--- .../net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c +4 -2
@@ -162,10 +162,12 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw,if (MLX5_CAP_ESW_INGRESS_ACL (esw->dev, flow_counter)) { counter =mlx5_fc_create (esw->dev, false); -if (IS_ERR (counter)) +if (IS_ERR (counter)) {esw_warn (esw->dev,"vport[%d] configure ingress drop rule counter failed\n" , vport->vport); + counter =NULL ; + } vport->ingress.legacy.drop_counter = counter; }
@@ -272,7 +274,7 @@ void esw_acl_ingress_lgcy_cleanup(struct mlx5_eswitch *esw,esw_acl_ingress_table_destroy (vport); clean_drop_counter: -if (!IS_ERR_OR_NULL (vport->ingress.legacy.drop_counter)) { +if (vport->ingress.legacy.drop_counter) {mlx5_fc_destroy (esw->dev, vport->ingress.legacy.drop_counter); vport->ingress.legacy.drop_counter =NULL ; }
Signature · 1 line
2.26.2
+ netdev
Quoted 40 lines · Dan Carpenter
We can't leave "counter" set to an error pointer. Otherwise either it will lead to an error pointer dereference later in the function or it leads to an error pointer dereference when we call
mlx5_fc_destroy().Fixes 07bab9502641d ("net/mlx5: E-Switch, Refactor eswitch ingress acl codes")Signed-off-by Dan Carpenter <[email protected]>--- .../net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c +4
-3@@ -162,10 +162,12 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw,if (MLX5_CAP_ESW_INGRESS_ACL (esw->dev, flow_counter)) { counter =mlx5_fc_create (esw->dev, false); -if (IS_ERR (counter)) +if (IS_ERR (counter)) {esw_warn (esw->dev,"vport[%d] configure ingress drop rule counter failed\n" , vport->vport); + counter =NULL ; + } vport->ingress.legacy.drop_counter = counter; }@@ -272,7 +274,7 @@ void esw_acl_ingress_lgcy_cleanup(struct mlx5_eswitch *esw,esw_acl_ingress_table_destroy (vport); clean_drop_counter: -if (!IS_ERR_OR_NULL (vport->ingress.legacy.drop_counter)) { +if (vport->ingress.legacy.drop_counter) {mlx5_fc_destroy (esw->dev, vport->ingress.legacy.drop_counter); vport->ingress.legacy.drop_counter =NULL ; } --2.26.2
Quoted 2 lines · Leon Romanovsky
+ netdev
This is sort of useless. What's netdev going to do with a patch they can't apply? I assumed that mellanox was going to take this through their tree...
Should I resend the other mlx5 patch as well?
regards,
dan carpenter
Quoted 7 lines · Dan Carpenter
Quoted 2 lines · Leon Romanovsky
+ netdev
This is sort of useless. What's netdev going to do with a patch they can't apply? I assumed that mellanox was going to take this through their tree...
Right, but it will be picked by Saeed who will send it to netdev later as PR. CCing netdev saves extra review at that stage.
Quoted 2 lines
Should I resend the other mlx5 patch as well?
I don't think so.
Quoted 4 lines
regards,
dan carpenter
Quoted 11 lines · Leon Romanovsky
Quoted 7 lines · Dan Carpenter
Quoted 2 lines · Leon Romanovsky
+ netdev
This is sort of useless. What's netdev going to do with a patch they can't apply? I assumed that mellanox was going to take this through their tree...
Right, but it will be picked by Saeed who will send it to netdev later as PR. CCing netdev saves extra review at that stage.
Okay. I will try to remember this in the future. I'll try put [PATCH mlx5-next] in the subject even when it applies to the net tree.
regards,
dan carpenter
Saeed Mahameed
AppliedQuoted 12 lines · Dan Carpenter
Quoted 11 lines · Leon Romanovsky
Quoted 9 lines · Dan Carpenter
Quoted 2 lines · Leon Romanovsky
+ netdev
This is sort of useless. What's netdev going to do with a patch they
can't apply? I assumed that mellanox was going to take this through
their tree...
Quoted 7 lines
Quoted 3 lines
Right, but it will be picked by Saeed who will send it to netdev later
as PR. CCing netdev saves extra review at that stage.Okay. I will try to remember this in the future. I'll try put [PATCH mlx5-next] in the subject even when it applies to the net tree.
Thanks Dan for the patch.
netdev is always open for fixes.
Applied to net-mlx5, will send this in today PR to net.
-Saeed.
Quoted 4 lines
regards,
dan carpenter