Commit 9c26f5f8 authored by Talat Batheesh's avatar Talat Batheesh Committed by Saeed Mahameed

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: fba53f7b ("net/mlx5: Introduce mlx5_flow_steering structure")
Signed-off-by: default avatarTalat Batheesh <talatb@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent d9a96ec3
...@@ -187,6 +187,7 @@ static void del_sw_ns(struct fs_node *node); ...@@ -187,6 +187,7 @@ static void del_sw_ns(struct fs_node *node);
static void del_sw_hw_rule(struct fs_node *node); static void del_sw_hw_rule(struct fs_node *node);
static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1, static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
struct mlx5_flow_destination *d2); struct mlx5_flow_destination *d2);
static void cleanup_root_ns(struct mlx5_flow_root_namespace *root_ns);
static struct mlx5_flow_rule * static struct mlx5_flow_rule *
find_flow_rule(struct fs_fte *fte, find_flow_rule(struct fs_fte *fte,
struct mlx5_flow_destination *dest); struct mlx5_flow_destination *dest);
...@@ -2351,23 +2352,27 @@ static int create_anchor_flow_table(struct mlx5_flow_steering *steering) ...@@ -2351,23 +2352,27 @@ static int create_anchor_flow_table(struct mlx5_flow_steering *steering)
static int init_root_ns(struct mlx5_flow_steering *steering) static int init_root_ns(struct mlx5_flow_steering *steering)
{ {
int err;
steering->root_ns = create_root_ns(steering, FS_FT_NIC_RX); steering->root_ns = create_root_ns(steering, FS_FT_NIC_RX);
if (!steering->root_ns) if (!steering->root_ns)
goto cleanup; return -ENOMEM;
if (init_root_tree(steering, &root_fs, &steering->root_ns->ns.node)) err = init_root_tree(steering, &root_fs, &steering->root_ns->ns.node);
goto cleanup; if (err)
goto out_err;
set_prio_attrs(steering->root_ns); set_prio_attrs(steering->root_ns);
err = create_anchor_flow_table(steering);
if (create_anchor_flow_table(steering)) if (err)
goto cleanup; goto out_err;
return 0; return 0;
cleanup: out_err:
mlx5_cleanup_fs(steering->dev); cleanup_root_ns(steering->root_ns);
return -ENOMEM; steering->root_ns = NULL;
return err;
} }
static void clean_tree(struct fs_node *node) static void clean_tree(struct fs_node *node)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment