@@ -1582,16 +1582,16 @@ struct match_list_head {
15821582 struct match_list first ;
15831583};
15841584
1585- static void free_match_list (struct match_list_head * head )
1585+ static void free_match_list (struct match_list_head * head , bool ft_locked )
15861586{
15871587 if (!list_empty (& head -> list )) {
15881588 struct match_list * iter , * match_tmp ;
15891589
15901590 list_del (& head -> first .list );
1591- tree_put_node (& head -> first .g -> node , false );
1591+ tree_put_node (& head -> first .g -> node , ft_locked );
15921592 list_for_each_entry_safe (iter , match_tmp , & head -> list ,
15931593 list ) {
1594- tree_put_node (& iter -> g -> node , false );
1594+ tree_put_node (& iter -> g -> node , ft_locked );
15951595 list_del (& iter -> list );
15961596 kfree (iter );
15971597 }
@@ -1600,7 +1600,8 @@ static void free_match_list(struct match_list_head *head)
16001600
16011601static int build_match_list (struct match_list_head * match_head ,
16021602 struct mlx5_flow_table * ft ,
1603- const struct mlx5_flow_spec * spec )
1603+ const struct mlx5_flow_spec * spec ,
1604+ bool ft_locked )
16041605{
16051606 struct rhlist_head * tmp , * list ;
16061607 struct mlx5_flow_group * g ;
@@ -1625,7 +1626,7 @@ static int build_match_list(struct match_list_head *match_head,
16251626
16261627 curr_match = kmalloc (sizeof (* curr_match ), GFP_ATOMIC );
16271628 if (!curr_match ) {
1628- free_match_list (match_head );
1629+ free_match_list (match_head , ft_locked );
16291630 err = - ENOMEM ;
16301631 goto out ;
16311632 }
@@ -1805,7 +1806,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
18051806 version = atomic_read (& ft -> node .version );
18061807
18071808 /* Collect all fgs which has a matching match_criteria */
1808- err = build_match_list (& match_head , ft , spec );
1809+ err = build_match_list (& match_head , ft , spec , take_write );
18091810 if (err ) {
18101811 if (take_write )
18111812 up_write_ref_node (& ft -> node , false);
@@ -1819,7 +1820,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
18191820
18201821 rule = try_add_to_existing_fg (ft , & match_head .list , spec , flow_act , dest ,
18211822 dest_num , version );
1822- free_match_list (& match_head );
1823+ free_match_list (& match_head , take_write );
18231824 if (!IS_ERR (rule ) ||
18241825 (PTR_ERR (rule ) != - ENOENT && PTR_ERR (rule ) != - EAGAIN )) {
18251826 if (take_write )
0 commit comments