aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_drr.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-26 00:13:31 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-26 00:13:31 -0500
commit71bcb09a57894fa35591ce93dd972065eeecb63a (patch)
tree50ca8a43125f0aa89f1444928a209420754a79f3 /net/sched/sch_drr.c
parent0e991ec6a0340916d3f29bd5dcb35299069e7226 (diff)
tc: check for errors in gen_rate_estimator creation
The functions gen_new_estimator and gen_replace_estimator can return errors, but they were being ignored. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_drr.c')
-rw-r--r--net/sched/sch_drr.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index e7a7e87b141a..f6b4fa97df70 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -82,15 +82,19 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
82 quantum = psched_mtu(qdisc_dev(sch)); 82 quantum = psched_mtu(qdisc_dev(sch));
83 83
84 if (cl != NULL) { 84 if (cl != NULL) {
85 if (tca[TCA_RATE]) {
86 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
87 qdisc_root_sleeping_lock(sch),
88 tca[TCA_RATE]);
89 if (err)
90 return err;
91 }
92
85 sch_tree_lock(sch); 93 sch_tree_lock(sch);
86 if (tb[TCA_DRR_QUANTUM]) 94 if (tb[TCA_DRR_QUANTUM])
87 cl->quantum = quantum; 95 cl->quantum = quantum;
88 sch_tree_unlock(sch); 96 sch_tree_unlock(sch);
89 97
90 if (tca[TCA_RATE])
91 gen_replace_estimator(&cl->bstats, &cl->rate_est,
92 qdisc_root_sleeping_lock(sch),
93 tca[TCA_RATE]);
94 return 0; 98 return 0;
95 } 99 }
96 100
@@ -106,10 +110,16 @@ static int drr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
106 if (cl->qdisc == NULL) 110 if (cl->qdisc == NULL)
107 cl->qdisc = &noop_qdisc; 111 cl->qdisc = &noop_qdisc;
108 112
109 if (tca[TCA_RATE]) 113 if (tca[TCA_RATE]) {
110 gen_replace_estimator(&cl->bstats, &cl->rate_est, 114 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
111 qdisc_root_sleeping_lock(sch), 115 qdisc_root_sleeping_lock(sch),
112 tca[TCA_RATE]); 116 tca[TCA_RATE]);
117 if (err) {
118 qdisc_destroy(cl->qdisc);
119 kfree(cl);
120 return err;
121 }
122 }
113 123
114 sch_tree_lock(sch); 124 sch_tree_lock(sch);
115 qdisc_class_hash_insert(&q->clhash, &cl->common); 125 qdisc_class_hash_insert(&q->clhash, &cl->common);