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>
This commit is contained in:
committed by
David S. Miller
parent
0e991ec6a0
commit
71bcb09a57
@@ -1018,6 +1018,14 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||
}
|
||||
cur_time = psched_get_time();
|
||||
|
||||
if (tca[TCA_RATE]) {
|
||||
err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
|
||||
qdisc_root_sleeping_lock(sch),
|
||||
tca[TCA_RATE]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
sch_tree_lock(sch);
|
||||
if (rsc != NULL)
|
||||
hfsc_change_rsc(cl, rsc, cur_time);
|
||||
@@ -1034,10 +1042,6 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||
}
|
||||
sch_tree_unlock(sch);
|
||||
|
||||
if (tca[TCA_RATE])
|
||||
gen_replace_estimator(&cl->bstats, &cl->rate_est,
|
||||
qdisc_root_sleeping_lock(sch),
|
||||
tca[TCA_RATE]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1063,6 +1067,16 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||
if (cl == NULL)
|
||||
return -ENOBUFS;
|
||||
|
||||
if (tca[TCA_RATE]) {
|
||||
err = gen_new_estimator(&cl->bstats, &cl->rate_est,
|
||||
qdisc_root_sleeping_lock(sch),
|
||||
tca[TCA_RATE]);
|
||||
if (err) {
|
||||
kfree(cl);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (rsc != NULL)
|
||||
hfsc_change_rsc(cl, rsc, 0);
|
||||
if (fsc != NULL)
|
||||
@@ -1093,9 +1107,6 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
|
||||
|
||||
qdisc_class_hash_grow(sch, &q->clhash);
|
||||
|
||||
if (tca[TCA_RATE])
|
||||
gen_new_estimator(&cl->bstats, &cl->rate_est,
|
||||
qdisc_root_sleeping_lock(sch), tca[TCA_RATE]);
|
||||
*arg = (unsigned long)cl;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user