Skip to content

Commit

Permalink
net: sched: fix static key imbalance in case of ingress/clsact_init e…
Browse files Browse the repository at this point in the history
…rror

Move static key increments to the beginning of the init function
so they pair 1:1 with decrements in ingress/clsact_destroy,
which is called in case ingress/clsact_init fails.

Fixes: 6529eab ("net: sched: introduce tcf block infractructure")
Signed-off-by: Jiri Pirko <[email protected]>
Acked-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jpirko authored and davem330 committed Dec 15, 2017
1 parent 343723d commit b59e697
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions net/sched/sch_ingress.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
struct net_device *dev = qdisc_dev(sch);
int err;

net_inc_ingress_queue();

mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress);

q->block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS;
Expand All @@ -78,7 +80,6 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
if (err)
return err;

net_inc_ingress_queue();
sch->flags |= TCQ_F_CPUSTATS;

return 0;
Expand Down Expand Up @@ -172,6 +173,9 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
struct net_device *dev = qdisc_dev(sch);
int err;

net_inc_ingress_queue();
net_inc_egress_queue();

mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress);

q->ingress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS;
Expand All @@ -192,9 +196,6 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
if (err)
return err;

net_inc_ingress_queue();
net_inc_egress_queue();

sch->flags |= TCQ_F_CPUSTATS;

return 0;
Expand Down

0 comments on commit b59e697

Please sign in to comment.