Commit 0e0751cd authored by Mark Bloch's avatar Mark Bloch Committed by Greg Kroah-Hartman

net/mlx5: Don't unlock fte while still using it

commit 0fd758d6 upstream.

When adding a new rule to an fte, we need to hold the fte lock
until we add that rule to the fte and increase the fte ref count.

Fixes: 0c56b975 ("net/mlx5_core: Introduce flow steering API")
Signed-off-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7c4c32a2
...@@ -1110,9 +1110,8 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg, ...@@ -1110,9 +1110,8 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg,
return rule; return rule;
} }
rule = add_rule_fte(fte, fg, dest); rule = add_rule_fte(fte, fg, dest);
unlock_ref_node(&fte->node);
if (IS_ERR(rule)) if (IS_ERR(rule))
goto unlock_fg; goto unlock_fte;
else else
goto add_rule; goto add_rule;
} }
...@@ -1130,6 +1129,7 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg, ...@@ -1130,6 +1129,7 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg,
goto unlock_fg; goto unlock_fg;
} }
tree_init_node(&fte->node, 0, del_fte); tree_init_node(&fte->node, 0, del_fte);
nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD);
rule = add_rule_fte(fte, fg, dest); rule = add_rule_fte(fte, fg, dest);
if (IS_ERR(rule)) { if (IS_ERR(rule)) {
kfree(fte); kfree(fte);
...@@ -1142,6 +1142,8 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg, ...@@ -1142,6 +1142,8 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg,
list_add(&fte->node.list, prev); list_add(&fte->node.list, prev);
add_rule: add_rule:
tree_add_node(&rule->node, &fte->node); tree_add_node(&rule->node, &fte->node);
unlock_fte:
unlock_ref_node(&fte->node);
unlock_fg: unlock_fg:
unlock_ref_node(&fg->node); unlock_ref_node(&fg->node);
return rule; return rule;
......
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