Skip to content

Commit 6ecec17

Browse files
talatbgregkh
authored andcommitted
net/mlx5: Avoid cleaning flow steering table twice during error flow
[ Upstream commit 9c26f5f ] When we fail to initialize the RX root namespace, we need to clean only that and not the entire flow steering. Currently the code may try to clean the flow steering twice on error witch leads to null pointer deference. Make sure we clean correctly. Fixes: fba53f7 ("net/mlx5: Introduce mlx5_flow_steering structure") Signed-off-by: Talat Batheesh <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent eac1ab6 commit 6ecec17

File tree

1 file changed

+14
-9
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+14
-9
lines changed

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ static void del_flow_group(struct fs_node *node);
174174
static void del_fte(struct fs_node *node);
175175
static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
176176
struct mlx5_flow_destination *d2);
177+
static void cleanup_root_ns(struct mlx5_flow_root_namespace *root_ns);
177178
static struct mlx5_flow_rule *
178179
find_flow_rule(struct fs_fte *fte,
179180
struct mlx5_flow_destination *dest);
@@ -2041,23 +2042,27 @@ static int create_anchor_flow_table(struct mlx5_flow_steering *steering)
20412042

20422043
static int init_root_ns(struct mlx5_flow_steering *steering)
20432044
{
2045+
int err;
2046+
20442047
steering->root_ns = create_root_ns(steering, FS_FT_NIC_RX);
20452048
if (!steering->root_ns)
2046-
goto cleanup;
2049+
return -ENOMEM;
20472050

2048-
if (init_root_tree(steering, &root_fs, &steering->root_ns->ns.node))
2049-
goto cleanup;
2051+
err = init_root_tree(steering, &root_fs, &steering->root_ns->ns.node);
2052+
if (err)
2053+
goto out_err;
20502054

20512055
set_prio_attrs(steering->root_ns);
2052-
2053-
if (create_anchor_flow_table(steering))
2054-
goto cleanup;
2056+
err = create_anchor_flow_table(steering);
2057+
if (err)
2058+
goto out_err;
20552059

20562060
return 0;
20572061

2058-
cleanup:
2059-
mlx5_cleanup_fs(steering->dev);
2060-
return -ENOMEM;
2062+
out_err:
2063+
cleanup_root_ns(steering->root_ns);
2064+
steering->root_ns = NULL;
2065+
return err;
20612066
}
20622067

20632068
static void clean_tree(struct fs_node *node)

0 commit comments

Comments
 (0)