]> git.baikalelectronics.ru Git - kernel.git/commit
pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM
authorEric Dumazet <edumazet@google.com>
Mon, 6 Jan 2020 14:10:39 +0000 (06:10 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Jan 2020 20:40:47 +0000 (12:40 -0800)
commit083ee6e22ace5b0b02a7d4cc35a1cb5d28221291
treefcba680930ee393e0c16aa75b782975674cba89c
parentf5600e1aa34d305937d758ca6b045a11ea2ccaa7
pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM

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: 1d72532bda4f ("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>
net/sched/sch_fq.c