diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-11-26 00:13:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-26 00:13:31 -0500 |
commit | 71bcb09a57894fa35591ce93dd972065eeecb63a (patch) | |
tree | 50ca8a43125f0aa89f1444928a209420754a79f3 /net/sched/sch_htb.c | |
parent | 0e991ec6a0340916d3f29bd5dcb35299069e7226 (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_htb.c')
-rw-r--r-- | net/sched/sch_htb.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 3a119f576bb3..8a4519989732 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1332,9 +1332,14 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1332 | if ((cl = kzalloc(sizeof(*cl), GFP_KERNEL)) == NULL) | 1332 | if ((cl = kzalloc(sizeof(*cl), GFP_KERNEL)) == NULL) |
1333 | goto failure; | 1333 | goto failure; |
1334 | 1334 | ||
1335 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1335 | err = gen_new_estimator(&cl->bstats, &cl->rate_est, |
1336 | qdisc_root_sleeping_lock(sch), | 1336 | qdisc_root_sleeping_lock(sch), |
1337 | tca[TCA_RATE] ? : &est.nla); | 1337 | tca[TCA_RATE] ? : &est.nla); |
1338 | if (err) { | ||
1339 | kfree(cl); | ||
1340 | goto failure; | ||
1341 | } | ||
1342 | |||
1338 | cl->refcnt = 1; | 1343 | cl->refcnt = 1; |
1339 | cl->children = 0; | 1344 | cl->children = 0; |
1340 | INIT_LIST_HEAD(&cl->un.leaf.drop_list); | 1345 | INIT_LIST_HEAD(&cl->un.leaf.drop_list); |
@@ -1386,10 +1391,13 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1386 | if (parent) | 1391 | if (parent) |
1387 | parent->children++; | 1392 | parent->children++; |
1388 | } else { | 1393 | } else { |
1389 | if (tca[TCA_RATE]) | 1394 | if (tca[TCA_RATE]) { |
1390 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1395 | err = gen_replace_estimator(&cl->bstats, &cl->rate_est, |
1391 | qdisc_root_sleeping_lock(sch), | 1396 | qdisc_root_sleeping_lock(sch), |
1392 | tca[TCA_RATE]); | 1397 | tca[TCA_RATE]); |
1398 | if (err) | ||
1399 | return err; | ||
1400 | } | ||
1393 | sch_tree_lock(sch); | 1401 | sch_tree_lock(sch); |
1394 | } | 1402 | } |
1395 | 1403 | ||