]> git.baikalelectronics.ru Git - kernel.git/commit
net/sched: sch_fq: fix integer overflow of "credit"
authorDavide Caratti <dcaratti@redhat.com>
Thu, 20 Apr 2023 14:59:46 +0000 (16:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:26 +0000 (23:03 +0900)
commit44f5da454d890a1125b0715dbcc5fd4a7fbf2b68
tree6201266f3f362e28ca3e0c8c6d78140c9c0c6a6c
parenta8e9173fe640bb5134f730782ac3915e0822933b
net/sched: sch_fq: fix integer overflow of "credit"

[ Upstream commit 7041101ff6c3073fd8f2e99920f535b111c929cb ]

if sch_fq is configured with "initial quantum" having values greater than
INT_MAX, the first assignment of "credit" does signed integer overflow to
a very negative value.
In this situation, the syzkaller script provided by Cristoph triggers the
CPU soft-lockup warning even with few sockets. It's not an infinite loop,
but "credit" wasn't probably meant to be minus 2Gb for each new flow.
Capping "initial quantum" to INT_MAX proved to fix the issue.

v2: validation of "initial quantum" is done in fq_policy, instead of open
    coding in fq_change() _ suggested by Jakub Kicinski

Reported-by: Christoph Paasch <cpaasch@apple.com>
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/377
Fixes: c80bf3d5e95c ("pkt_sched: fq: Fair Queue packet scheduler")
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Link: https://lore.kernel.org/r/7b3a3c7e36d03068707a021760a194a8eb5ad41a.1682002300.git.dcaratti@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/sch_fq.c
tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq.json