diff options
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_sfq.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 4cff44235773..c2e628dfaacc 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -491,17 +491,18 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) | |||
491 | if (opt->nla_len < nla_attr_size(sizeof(*ctl))) | 491 | if (opt->nla_len < nla_attr_size(sizeof(*ctl))) |
492 | return -EINVAL; | 492 | return -EINVAL; |
493 | 493 | ||
494 | if (ctl->divisor && | ||
495 | (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536)) | ||
496 | return -EINVAL; | ||
497 | |||
494 | sch_tree_lock(sch); | 498 | sch_tree_lock(sch); |
495 | q->quantum = ctl->quantum ? : psched_mtu(qdisc_dev(sch)); | 499 | q->quantum = ctl->quantum ? : psched_mtu(qdisc_dev(sch)); |
496 | q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); | 500 | q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); |
497 | q->perturb_period = ctl->perturb_period * HZ; | 501 | q->perturb_period = ctl->perturb_period * HZ; |
498 | if (ctl->limit) | 502 | if (ctl->limit) |
499 | q->limit = min_t(u32, ctl->limit, SFQ_DEPTH - 1); | 503 | q->limit = min_t(u32, ctl->limit, SFQ_DEPTH - 1); |
500 | if (ctl->divisor) { | 504 | if (ctl->divisor) |
501 | if (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536) | ||
502 | return -EINVAL; | ||
503 | q->divisor = ctl->divisor; | 505 | q->divisor = ctl->divisor; |
504 | } | ||
505 | qlen = sch->q.qlen; | 506 | qlen = sch->q.qlen; |
506 | while (sch->q.qlen > q->limit) | 507 | while (sch->q.qlen > q->limit) |
507 | sfq_drop(sch); | 508 | sfq_drop(sch); |