diff options
author | Eric Dumazet <edumazet@google.com> | 2020-01-06 06:10:39 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-12 11:24:26 +0100 |
commit | 9e9dcbc9e5ceeaa716339d3700850c196c8de91f (patch) | |
tree | a0d8f51f1ff83bb5e03b0158a41b2df8f0ff8ed8 | |
parent | eca9a2f2b97b59f8749c0b5e0a5ca854e25b21d2 (diff) | |
download | linux-stable-9e9dcbc9e5ceeaa716339d3700850c196c8de91f.tar.gz linux-stable-9e9dcbc9e5ceeaa716339d3700850c196c8de91f.tar.bz2 linux-stable-9e9dcbc9e5ceeaa716339d3700850c196c8de91f.zip |
pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
[ Upstream commit d9e15a2733067c9328fb56d98fe8e574fa19ec31 ]
As diagnosed by Florian :
If TCA_FQ_QUANTUM is set to 0x80000000, fq_deueue()
can loop forever in :
if (f->credit <= 0) {
f->credit += q->quantum;
goto begin;
}
... because f->credit is either 0 or -2147483648.
Let's limit TCA_FQ_QUANTUM to no more than 1 << 20 :
This max value should limit risks of breaking user setups
while fixing this bug.
Fixes: afe4fd062416 ("pkt_sched: fq: Fair Queue packet scheduler")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Diagnosed-by: Florian Westphal <fw@strlen.de>
Reported-by: syzbot+dc9071cc5a85950bdfce@syzkaller.appspotmail.com
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/sched/sch_fq.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index b57b4de73038..7e7eba33bbdb 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c @@ -736,7 +736,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt) if (tb[TCA_FQ_QUANTUM]) { u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); - if (quantum > 0) + if (quantum > 0 && quantum <= (1 << 20)) q->quantum = quantum; else err = -EINVAL; |