aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_hfsc.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_hfsc.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_hfsc.c')
-rw-r--r--net/sched/sch_hfsc.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 613179c9969c..45c31b1a4e1d 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1018,6 +1018,14 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
1018 } 1018 }
1019 cur_time = psched_get_time(); 1019 cur_time = psched_get_time();
1020 1020
1021 if (tca[TCA_RATE]) {
1022 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
1023 qdisc_root_sleeping_lock(sch),
1024 tca[TCA_RATE]);
1025 if (err)
1026 return err;
1027 }
1028
1021 sch_tree_lock(sch); 1029 sch_tree_lock(sch);
1022 if (rsc != NULL) 1030 if (rsc != NULL)
1023 hfsc_change_rsc(cl, rsc, cur_time); 1031 hfsc_change_rsc(cl, rsc, cur_time);
@@ -1034,10 +1042,6 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
1034 } 1042 }
1035 sch_tree_unlock(sch); 1043 sch_tree_unlock(sch);
1036 1044
1037 if (tca[TCA_RATE])
1038 gen_replace_estimator(&cl->bstats, &cl->rate_est,
1039 qdisc_root_sleeping_lock(sch),
1040 tca[TCA_RATE]);
1041 return 0; 1045 return 0;
1042 } 1046 }
1043 1047
@@ -1063,6 +1067,16 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
1063 if (cl == NULL) 1067 if (cl == NULL)
1064 return -ENOBUFS; 1068 return -ENOBUFS;
1065 1069
1070 if (tca[TCA_RATE]) {
1071 err = gen_new_estimator(&cl->bstats, &cl->rate_est,
1072 qdisc_root_sleeping_lock(sch),
1073 tca[TCA_RATE]);
1074 if (err) {
1075 kfree(cl);
1076 return err;
1077 }
1078 }
1079
1066 if (rsc != NULL) 1080 if (rsc != NULL)
1067 hfsc_change_rsc(cl, rsc, 0); 1081 hfsc_change_rsc(cl, rsc, 0);
1068 if (fsc != NULL) 1082 if (fsc != NULL)
@@ -1093,9 +1107,6 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
1093 1107
1094 qdisc_class_hash_grow(sch, &q->clhash); 1108 qdisc_class_hash_grow(sch, &q->clhash);
1095 1109
1096 if (tca[TCA_RATE])
1097 gen_new_estimator(&cl->bstats, &cl->rate_est,
1098 qdisc_root_sleeping_lock(sch), tca[TCA_RATE]);
1099 *arg = (unsigned long)cl; 1110 *arg = (unsigned long)cl;
1100 return 0; 1111 return 0;
1101} 1112}