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 7F99141A795; Sat, 12 Sep 2026 15:19:56 +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=1789226399; cv=none; b=bHMCrEI39K2oe2qXtFNLRVbcx+bepISjuatwobBSb/4tig7n96qX3X4GdrDRx69EBcBHfWskgZGQUpfQJND3zTxvbGE0GU7NHuHCfNyuGX9kAxAxaeYQYDscf474xyAyc7DA8WGjqX3HAe4Afko6Jv16LZPDohyMVtm+Jer+Ekg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789226399; c=relaxed/simple; bh=HMbMvu6UGvSVYh8rBjWN8N23WtAI+tIYL9F2G+g/bBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ufdCjCopf1dDLmpRxyKr5L5DFOw7clkH0rmhXHO/jOkPpkpUPNV8q1bzRCpFlmScH1gM4te1953CfL3eC7Yvkfe/1T/EkE6Qmnc8qnPJNfsOeN5xM/Abd4+hfTvg8GG4QjZoUzGV7CXmHUb0uhbc7hu4bxkH+jLxA83d9EO3uhc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=P8H9JzSV; 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="P8H9JzSV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 561D81F000FF; Sat, 12 Sep 2026 15:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789226395; bh=Uf299pUzn8cFRzc5Kb1K9G7UsxRmpEkWA2uEJOmukvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=P8H9JzSVVkzmySnJvjVnjYIznACVR9lvjkCwWh/RxiXwnXO+oOnljCyBglLAN6H1z K2ceLEjOeAXuezk6drQ1FbIC1VajIGYCxbvKeA/Nxwt2LSa0UBi/hx2aauGoI1AArj DkN3PhUJ7NJmwa0JftSZdE5NakSfYIBDkOnr7saA= 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 1366/1424] net/sched: sfq: clamp quantum to avoid signed overflow soft lockup Date: Sat, 12 Sep 2026 09:03:18 +0200 Message-ID: <20260912065637.853846356@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@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 816e90057ab1879562a5b7cc688e35bb9027ae97 ] sfq_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) (unsigned). A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes psched_mtu() return 0x80000000, so slot->allot = INT_MIN and INT_MIN + INT_MIN toggles between INT_MIN and 0 forever, spinning sfq_dequeue() under the qdisc lock. Clamp the quantum to [256, 1 << 20] so the refill loop terminates. The lower bound also covers q->quantum == 0 (psched_mtu() returning 0), which spins sfq_dequeue() identically. sfq_change() already rejects a negative quantum, so only the init path was exposed. 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: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: vega@nebusec.ai Tested-by: Victor Nogueira Signed-off-by: Jamal Hadi Salim Link: https://patch.msgid.link/20260822195509.112717-7-jhs@mojatatu.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/sched/sch_sfq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index e871cb53946a3..a53ea6ac2296f 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c @@ -796,7 +796,8 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt, q->tail = NULL; q->divisor = SFQ_DEFAULT_HASH_DIVISOR; q->maxflows = SFQ_DEFAULT_FLOWS; - q->quantum = psched_mtu(qdisc_dev(sch)); + q->quantum = clamp_t(u32, psched_mtu(qdisc_dev(sch)), + 256, 1 << 20); q->perturb_period = 0; get_random_bytes(&q->perturbation, sizeof(q->perturbation)); -- 2.53.0