From: Roi Dayan Date: Mon, 29 May 2023 06:32:57 +0000 (+0300) Subject: net/mlx5e: E-Switch, Fix shared fdb error flow X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=15ddd72ee323cf4b7012dc8e002ebb812f92e11f;p=linux.git net/mlx5e: E-Switch, Fix shared fdb error flow On error flow resources being freed in esw_master_egress_destroy_resources() but pointers not being set to null if error flow is from creating a bounce rule. Then in esw_acl_egress_ofld_cleanup() we try to access already freed pointers. Fix it by resetting the pointers to null. Also if error is from creating a second or later bounce rule then the flow group and table being used and cannot and should not be freed. Add a check to destroy the flow group and table if there are no bounce rules. mlx5_core.sf mlx5_core.sf.2: mlx5_destroy_flow_group:2306:(pid 2235): Flow group 4 wasn't destroyed, refcount > 1 mlx5_core.sf mlx5_core.sf.2: mlx5_destroy_flow_table:2295:(pid 2235): Flow table 3 wasn't destroyed, refcount > 1 Fixes: 5e0202eb49ed ("net/mlx5: E-switch, Handle multiple master egress rules") Signed-off-by: Roi Dayan Reviewed-by: Shay Drory Signed-off-by: Saeed Mahameed --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 612be82a8ad51..cf58295ad7e22 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2618,8 +2618,12 @@ out: static void esw_master_egress_destroy_resources(struct mlx5_vport *vport) { + if (!xa_empty(&vport->egress.offloads.bounce_rules)) + return; mlx5_destroy_flow_group(vport->egress.offloads.bounce_grp); + vport->egress.offloads.bounce_grp = NULL; mlx5_destroy_flow_table(vport->egress.acl); + vport->egress.acl = NULL; } static int esw_set_master_egress_rule(struct mlx5_core_dev *master,