Skip to content

Commit a1ddcfe

Browse files
jrfastabdavem330
authored andcommitted
net: cls_u32: fix missed pcpu_success free_percpu
This fixes a missed free_percpu in the unwind code path and when keys are destroyed. Signed-off-by: John Fastabend <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 37ab7dd commit a1ddcfe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/sched/cls_u32.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n)
362362
n->ht_down->refcnt--;
363363
#ifdef CONFIG_CLS_U32_PERF
364364
free_percpu(n->pf);
365+
#endif
366+
#ifdef CONFIG_CLS_U32_MARK
367+
free_percpu(n->pcpu_success);
365368
#endif
366369
kfree(n);
367370
return 0;
@@ -693,6 +696,10 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
693696

694697
#ifdef CONFIG_CLS_U32_MARK
695698
n->pcpu_success = alloc_percpu(u32);
699+
if (!n->pcpu_success) {
700+
err = -ENOMEM;
701+
goto errout;
702+
}
696703

697704
if (tb[TCA_U32_MARK]) {
698705
struct tc_u32_mark *mark;
@@ -720,6 +727,12 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
720727
*arg = (unsigned long)n;
721728
return 0;
722729
}
730+
731+
#ifdef CONFIG_CLS_U32_MARK
732+
free_percpu(n->pcpu_success);
733+
#endif
734+
735+
errout:
723736
#ifdef CONFIG_CLS_U32_PERF
724737
free_percpu(n->pf);
725738
#endif

0 commit comments

Comments
 (0)