Commit b59e6979 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

net: sched: fix static key imbalance in case of ingress/clsact_init error

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: 6529eaba ("net: sched: introduce tcf block infractructure")
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 343723dd
...@@ -68,6 +68,8 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -68,6 +68,8 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
int err; int err;
net_inc_ingress_queue();
mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress); mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress);
q->block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; q->block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS;
...@@ -78,7 +80,6 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -78,7 +80,6 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
if (err) if (err)
return err; return err;
net_inc_ingress_queue();
sch->flags |= TCQ_F_CPUSTATS; sch->flags |= TCQ_F_CPUSTATS;
return 0; return 0;
...@@ -172,6 +173,9 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -172,6 +173,9 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
struct net_device *dev = qdisc_dev(sch); struct net_device *dev = qdisc_dev(sch);
int err; int err;
net_inc_ingress_queue();
net_inc_egress_queue();
mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress); mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress);
q->ingress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; q->ingress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS;
...@@ -192,9 +196,6 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt) ...@@ -192,9 +196,6 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
if (err) if (err)
return err; return err;
net_inc_ingress_queue();
net_inc_egress_queue();
sch->flags |= TCQ_F_CPUSTATS; sch->flags |= TCQ_F_CPUSTATS;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment