aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2017-12-15 06:40:13 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-15 15:43:12 -0500
commitb59e6979a86384e68b0ab6ffeab11f0034fba82d (patch)
tree80092ec432ee3fa8cf5689cd9e01e5bd6cee38cc
parent343723dd51ef1025a860e54df9472b5ba21ee3d9 (diff)
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: 6529eaba33f0 ("net: sched: introduce tcf block infractructure") Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/sch_ingress.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 5e1cd2e5df87..fc1286f499c1 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -68,6 +68,8 @@ static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
68 struct net_device *dev = qdisc_dev(sch); 68 struct net_device *dev = qdisc_dev(sch);
69 int err; 69 int err;
70 70
71 net_inc_ingress_queue();
72
71 mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress); 73 mini_qdisc_pair_init(&q->miniqp, sch, &dev->miniq_ingress);
72 74
73 q->block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; 75 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 if (err) 80 if (err)
79 return err; 81 return err;
80 82
81 net_inc_ingress_queue();
82 sch->flags |= TCQ_F_CPUSTATS; 83 sch->flags |= TCQ_F_CPUSTATS;
83 84
84 return 0; 85 return 0;
@@ -172,6 +173,9 @@ static int clsact_init(struct Qdisc *sch, struct nlattr *opt)
172 struct net_device *dev = qdisc_dev(sch); 173 struct net_device *dev = qdisc_dev(sch);
173 int err; 174 int err;
174 175
176 net_inc_ingress_queue();
177 net_inc_egress_queue();
178
175 mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress); 179 mini_qdisc_pair_init(&q->miniqp_ingress, sch, &dev->miniq_ingress);
176 180
177 q->ingress_block_info.binder_type = TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS; 181 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 if (err) 196 if (err)
193 return err; 197 return err;
194 198
195 net_inc_ingress_queue();
196 net_inc_egress_queue();
197
198 sch->flags |= TCQ_F_CPUSTATS; 199 sch->flags |= TCQ_F_CPUSTATS;
199 200
200 return 0; 201 return 0;