Commit 9238e380 authored by Vlad Buslov's avatar Vlad Buslov Committed by Saeed Mahameed

net/mlx5: Fix error handling when adding flow rules

If building match list or adding existing fg fails when
node is locked, function returned without unlocking it.
This happened if node version changed or adding existing fg
returned with EAGAIN after jumping to search_again_locked label.

Fixes: bd71b08e ("net/mlx5: Support multiple updates of steering rules in parallel")
Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
Reviewed-by: default avatarMaor Gottlieb <maorg@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 26a0f6e8
...@@ -1759,8 +1759,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft, ...@@ -1759,8 +1759,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
/* Collect all fgs which has a matching match_criteria */ /* Collect all fgs which has a matching match_criteria */
err = build_match_list(&match_head, ft, spec); err = build_match_list(&match_head, ft, spec);
if (err) if (err) {
if (take_write)
up_write_ref_node(&ft->node);
return ERR_PTR(err); return ERR_PTR(err);
}
if (!take_write) if (!take_write)
up_read_ref_node(&ft->node); up_read_ref_node(&ft->node);
...@@ -1769,8 +1772,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft, ...@@ -1769,8 +1772,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
dest_num, version); dest_num, version);
free_match_list(&match_head); free_match_list(&match_head);
if (!IS_ERR(rule) || if (!IS_ERR(rule) ||
(PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN)) (PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN)) {
if (take_write)
up_write_ref_node(&ft->node);
return rule; return rule;
}
if (!take_write) { if (!take_write) {
nested_down_write_ref_node(&ft->node, FS_LOCK_GRANDPARENT); nested_down_write_ref_node(&ft->node, FS_LOCK_GRANDPARENT);
......
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