Skip to content

Commit 9c26f5f

Browse files
talatbSaeed Mahameed
authored andcommitted
net/mlx5: Avoid cleaning flow steering table twice during error flow
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]>
1 parent d9a96ec commit 9c26f5f

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
@@ -187,6 +187,7 @@ static void del_sw_ns(struct fs_node *node);
187187
static void del_sw_hw_rule(struct fs_node *node);
188188
static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
189189
struct mlx5_flow_destination *d2);
190+
static void cleanup_root_ns(struct mlx5_flow_root_namespace *root_ns);
190191
static struct mlx5_flow_rule *
191192
find_flow_rule(struct fs_fte *fte,
192193
struct mlx5_flow_destination *dest);
@@ -2351,23 +2352,27 @@ static int create_anchor_flow_table(struct mlx5_flow_steering *steering)
23512352

23522353
static int init_root_ns(struct mlx5_flow_steering *steering)
23532354
{
2355+
int err;
2356+
23542357
steering->root_ns = create_root_ns(steering, FS_FT_NIC_RX);
23552358
if (!steering->root_ns)
2356-
goto cleanup;
2359+
return -ENOMEM;
23572360

2358-
if (init_root_tree(steering, &root_fs, &steering->root_ns->ns.node))
2359-
goto cleanup;
2361+
err = init_root_tree(steering, &root_fs, &steering->root_ns->ns.node);
2362+
if (err)
2363+
goto out_err;
23602364

23612365
set_prio_attrs(steering->root_ns);
2362-
2363-
if (create_anchor_flow_table(steering))
2364-
goto cleanup;
2366+
err = create_anchor_flow_table(steering);
2367+
if (err)
2368+
goto out_err;
23652369

23662370
return 0;
23672371

2368-
cleanup:
2369-
mlx5_cleanup_fs(steering->dev);
2370-
return -ENOMEM;
2372+
out_err:
2373+
cleanup_root_ns(steering->root_ns);
2374+
steering->root_ns = NULL;
2375+
return err;
23712376
}
23722377

23732378
static void clean_tree(struct fs_node *node)

0 commit comments

Comments
 (0)