Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2ED603A1E92; Sat, 17 Oct 2026 17:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792259917; cv=none; b=qJW+zfbJRYi9bN1orIX11KEKbAVmXdEoYaH2h3FnqDse3kx/0x/vBZfCIGVYLjn/PkTBlJ6TxcC7TzH19RETMwU9vFSdvtJFlbKjbjUgAP4mACkEiVoOSkQ2oyjL/CKn6nrhKpzL5zV3ksqQjFrqGoEFF+UBSNowYVebR2ttE0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792259917; c=relaxed/simple; bh=gbEik2bspSkc83CwPcl1Jom/lPZE3WbQ2yzg4SCcllA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EmZGPxgj+EeLyYcaYtLLv167iUrWZyTCHJktv/aoE/+dNYJNy038RSBH1O9J1yIpejkGzFv+RO90IZvoS4PGTvl5Z+2Lgi0YZku7Wj6f6xpkR9Oh2ohbnrlE/jtioXjAWziVbxDCDBwEB2e7wPM6kUqtcdZuXmH7yRvEJrAimVA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Lg2MMOJS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Lg2MMOJS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7268C1F000C4; Sat, 17 Oct 2026 17:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792259915; bh=3k1LNaaoF12MwEma5XsUHhLjwH0LL11iVq9t67KEnaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Lg2MMOJSjrqkmIxclplV81N8lOiFhenUNxY3xjBxE8xzZNikwn2TKL4bFouIBpQG4 De4yGPAwQFV41Ai36nQ8JNmPWr7UrG7yg5mzoKU4KVgtneoWWKNpOP2DJyg/QjV4Vg IZSeopXW/SYtGoKpnx+XYKcFYsarF4J13vZI6si4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, vega@nebusec.ai, Victor Nogueira , Jamal Hadi Salim , Paolo Abeni , Sasha Levin Subject: [PATCH 6.6 1373/1674] net/sched: fq: add overflow bounds to quantum and initial quantum Date: Sat, 17 Oct 2026 18:00:45 +0200 Message-ID: <20261017160506.404405614@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jamal Hadi Salim [ Upstream commit 709f34f7c28dc4dd6c40343d101850f11e172312 ] fq_init() computes quantum = 2 * psched_mtu() and initial_quantum = 10 * psched_mtu() with no overflow check. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000; the 2 * and 10 * multiplications wrap to 0 in 32-bit arithmetic, so q->quantum == 0. Then in fq_dequeue() the credit-refill loop adds 0 to f->credit (which stays <= 0) and goto begin loops forever under the qdisc lock, creating a soft lockup. Clamp psched_mtu() to [1, 1 << 20] before multiplying so the product cannot wrap, then cap the result at 1 << 20, matching the bound already enforced on TCA_FQ_QUANTUM in fq_change(). Conditions to recreate the bug: a device whose MTU (plus hard_header_len) is large enough that 2 * psched_mtu() wraps (e.g. a dummy device with max_mtu == 0 accepting MTU 2147483634). Requires CAP_NET_ADMIN in a user namespace. Fixes: afe4fd062416 ("pkt_sched: fq: Fair Queue packet scheduler") Reported-by: vega@nebusec.ai Tested-by: Victor Nogueira Signed-off-by: Jamal Hadi Salim Link: https://patch.msgid.link/20260822195509.112717-2-jhs@mojatatu.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/sched/sch_fq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index a99950d8baa1b..edabe21ef3038 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c @@ -940,12 +940,14 @@ static int fq_init(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { struct fq_sched_data *q = qdisc_priv(sch); + u32 mtu; int err; sch->limit = 10000; q->flow_plimit = 100; - q->quantum = 2 * psched_mtu(qdisc_dev(sch)); - q->initial_quantum = 10 * psched_mtu(qdisc_dev(sch)); + mtu = clamp_t(u32, psched_mtu(qdisc_dev(sch)), 1, 1 << 20); + q->quantum = min_t(u32, 2 * mtu, 1 << 20); + q->initial_quantum = min_t(u32, 10 * mtu, 1 << 20); q->flow_refill_delay = msecs_to_jiffies(40); q->flow_max_rate = ~0UL; q->time_next_delayed_flow = ~0ULL; -- 2.53.0