@@ -390,14 +390,19 @@ static int u32_init(struct tcf_proto *tp)
390390 return 0 ;
391391}
392392
393- static int u32_destroy_key (struct tc_u_knode * n , bool free_pf )
393+ static void __u32_destroy_key (struct tc_u_knode * n )
394394{
395395 struct tc_u_hnode * ht = rtnl_dereference (n -> ht_down );
396396
397397 tcf_exts_destroy (& n -> exts );
398- tcf_exts_put_net (& n -> exts );
399398 if (ht && -- ht -> refcnt == 0 )
400399 kfree (ht );
400+ kfree (n );
401+ }
402+
403+ static void u32_destroy_key (struct tc_u_knode * n , bool free_pf )
404+ {
405+ tcf_exts_put_net (& n -> exts );
401406#ifdef CONFIG_CLS_U32_PERF
402407 if (free_pf )
403408 free_percpu (n -> pf );
@@ -406,8 +411,7 @@ static int u32_destroy_key(struct tc_u_knode *n, bool free_pf)
406411 if (free_pf )
407412 free_percpu (n -> pcpu_success );
408413#endif
409- kfree (n );
410- return 0 ;
414+ __u32_destroy_key (n );
411415}
412416
413417/* u32_delete_key_rcu should be called when free'ing a copied
@@ -903,13 +907,13 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
903907 tca [TCA_RATE ], ovr , extack );
904908
905909 if (err ) {
906- u32_destroy_key (new , false );
910+ __u32_destroy_key (new );
907911 return err ;
908912 }
909913
910914 err = u32_replace_hw_knode (tp , new , flags , extack );
911915 if (err ) {
912- u32_destroy_key (new , false );
916+ __u32_destroy_key (new );
913917 return err ;
914918 }
915919
0 commit comments