Skip to content

Commit

Permalink
net/mlx5: Fix potential sleeping in atomic context
Browse files Browse the repository at this point in the history
Fixes the below flow of sleeping in atomic context by releasing
the RCU lock before calling to free_match_list.

build_match_list() <- disables preempt
-> free_match_list()
   -> tree_put_node()
      -> down_write_ref_node() <- take write lock

Fixes: 693c688 ("net/mlx5: Add hash table for flow groups in flow table")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
Maor Gottlieb authored and Saeed Mahameed committed Sep 7, 2021
1 parent dfe6fd7 commit ee27e33
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1682,14 +1682,13 @@ static int build_match_list(struct match_list *match_head,

curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC);
if (!curr_match) {
rcu_read_unlock();
free_match_list(match_head, ft_locked);
err = -ENOMEM;
goto out;
return -ENOMEM;
}
curr_match->g = g;
list_add_tail(&curr_match->list, &match_head->list);
}
out:
rcu_read_unlock();
return err;
}
Expand Down

0 comments on commit ee27e33

Please sign in to comment.