@@ -1555,16 +1555,16 @@ struct match_list_head {
15551555 struct match_list first ;
15561556};
15571557
1558- static void free_match_list (struct match_list_head * head )
1558+ static void free_match_list (struct match_list_head * head , bool ft_locked )
15591559{
15601560 if (!list_empty (& head -> list )) {
15611561 struct match_list * iter , * match_tmp ;
15621562
15631563 list_del (& head -> first .list );
1564- tree_put_node (& head -> first .g -> node , false );
1564+ tree_put_node (& head -> first .g -> node , ft_locked );
15651565 list_for_each_entry_safe (iter , match_tmp , & head -> list ,
15661566 list ) {
1567- tree_put_node (& iter -> g -> node , false );
1567+ tree_put_node (& iter -> g -> node , ft_locked );
15681568 list_del (& iter -> list );
15691569 kfree (iter );
15701570 }
@@ -1573,7 +1573,8 @@ static void free_match_list(struct match_list_head *head)
15731573
15741574static int build_match_list (struct match_list_head * match_head ,
15751575 struct mlx5_flow_table * ft ,
1576- const struct mlx5_flow_spec * spec )
1576+ const struct mlx5_flow_spec * spec ,
1577+ bool ft_locked )
15771578{
15781579 struct rhlist_head * tmp , * list ;
15791580 struct mlx5_flow_group * g ;
@@ -1598,7 +1599,7 @@ static int build_match_list(struct match_list_head *match_head,
15981599
15991600 curr_match = kmalloc (sizeof (* curr_match ), GFP_ATOMIC );
16001601 if (!curr_match ) {
1601- free_match_list (match_head );
1602+ free_match_list (match_head , ft_locked );
16021603 err = - ENOMEM ;
16031604 goto out ;
16041605 }
@@ -1778,7 +1779,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
17781779 version = atomic_read (& ft -> node .version );
17791780
17801781 /* Collect all fgs which has a matching match_criteria */
1781- err = build_match_list (& match_head , ft , spec );
1782+ err = build_match_list (& match_head , ft , spec , take_write );
17821783 if (err ) {
17831784 if (take_write )
17841785 up_write_ref_node (& ft -> node , false);
@@ -1792,7 +1793,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
17921793
17931794 rule = try_add_to_existing_fg (ft , & match_head .list , spec , flow_act , dest ,
17941795 dest_num , version );
1795- free_match_list (& match_head );
1796+ free_match_list (& match_head , take_write );
17961797 if (!IS_ERR (rule ) ||
17971798 (PTR_ERR (rule ) != - ENOENT && PTR_ERR (rule ) != - EAGAIN )) {
17981799 if (take_write )
0 commit comments