Skip to content

Commit

Permalink
net/mlx5: Fix error handling when adding flow rules
Browse files Browse the repository at this point in the history
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: bd71b08 ("net/mlx5: Support multiple updates of steering rules in parallel")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
Vlad Buslov authored and Saeed Mahameed committed Feb 20, 2018
1 parent 26a0f6e commit 9238e38
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1759,8 +1759,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,

/* Collect all fgs which has a matching match_criteria */
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);
}

if (!take_write)
up_read_ref_node(&ft->node);
Expand All @@ -1769,8 +1772,11 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
dest_num, version);
free_match_list(&match_head);
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;
}

if (!take_write) {
nested_down_write_ref_node(&ft->node, FS_LOCK_GRANDPARENT);
Expand Down

0 comments on commit 9238e38

Please sign in to comment.