Commit ee27e330 authored by Maor Gottlieb's avatar Maor Gottlieb Committed by Saeed Mahameed

net/mlx5: Fix potential sleeping in atomic context

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: 693c6883 ("net/mlx5: Add hash table for flow groups in flow table")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMaor Gottlieb <maorg@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent dfe6fd72
...@@ -1682,14 +1682,13 @@ static int build_match_list(struct match_list *match_head, ...@@ -1682,14 +1682,13 @@ static int build_match_list(struct match_list *match_head,
curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC); curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC);
if (!curr_match) { if (!curr_match) {
rcu_read_unlock();
free_match_list(match_head, ft_locked); free_match_list(match_head, ft_locked);
err = -ENOMEM; return -ENOMEM;
goto out;
} }
curr_match->g = g; curr_match->g = g;
list_add_tail(&curr_match->list, &match_head->list); list_add_tail(&curr_match->list, &match_head->list);
} }
out:
rcu_read_unlock(); rcu_read_unlock();
return err; return err;
} }
......
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