]> git.hungrycats.org Git - linux/commitdiff
net/sched: fq_pie: clamp default quantum to avoid signed overflow
authorJamal Hadi Salim <jhs@mojatatu.com>
Sat, 22 Aug 2026 19:55:07 +0000 (15:55 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Sep 2026 11:36:13 +0000 (13:36 +0200)
[ Upstream commit c86cd7ed0b0e44779a3d1683f03e4353baf4bdc9 ]

fq_pie_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) without
clamping. A device with a huge MTU (e.g. dummy with max_mtu == 0
accepting MTU 2147483634) makes psched_mtu() return 0x80000000, which
overflows the signed flow->deficit to INT_MIN in fq_pie_qdisc_dequeue(),
causing an infinite loop and soft lockup. Emulate fq_pie_policy which
is already bounded to [1, 1 << 20]; clamp the default to [256, 1 << 20].
256 matches fq_codel's floor and is a sane minimum for a DRR quantum.

Conditions to recreate the bug: a device whose MTU (plus
hard_header_len) wraps psched_mtu() into the sign bit (e.g. a dummy
device with max_mtu == 0 accepting MTU 2147483634). Requires
CAP_NET_ADMIN in a user namespace.

Fixes: ec97ecf1ebe4 ("net: sched: add Flow Queue PIE packet scheduler")
Reported-by: vega@nebusec.ai
Tested-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20260822195509.112717-5-jhs@mojatatu.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/sch_fq_pie.c

index 0c7b2095f865579e789283729c48ee66cb478d06..4b829d894af1cb0b38348dc59d370786d404596e 100644 (file)
@@ -427,7 +427,8 @@ static int fq_pie_init(struct Qdisc *sch, struct nlattr *opt,
        pie_params_init(&q->p_params);
        sch->limit = 10 * 1024;
        q->p_params.limit = sch->limit;
-       q->quantum = psched_mtu(qdisc_dev(sch));
+       q->quantum = clamp_t(u32, psched_mtu(qdisc_dev(sch)),
+                            256, 1 << 20);
        q->sch = sch;
        q->ecn_prob = 10;
        q->flows_cnt = 1024;