From mboxrd@z Thu Jan 1 00:00:00 1970 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 BEEAB3A5E88; Sat, 12 Sep 2026 20:04:27 +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=1789243468; cv=none; b=Ig8Uk2Dk8dHmY9Us+QdsHH2WhOlIEAPZp3ofu/YZUerYVvAyQcnKD6fVMT//h8E43iwAhrmhKCAzZvdp3i2pnhOOlVpiEtk0cPz69l1FdUlFTT8O84aDiYI5+k6vBEZsu35Gsp5awBi1Pp0F3hoHQpPB7J5+Tv63QFE2mdsG4oQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789243468; c=relaxed/simple; bh=IlRZl6UkVfuj2pGn027PH/4v84NM5w+Kuj4sGY0Q9TQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tdKHC02ZlWY24t0YXY+xPFHd97sXJE7DyYgkgw6eFIrnnl00wDcGoUXLrVH43D9YuBpA06/ZJlkhjyteQHCSHIYt2/XQeuD8QhjVNWvMRTtags00FQNSV60UrLLfnmgc2x0KfmmqwBcC06clCYPIkp+AM9T3Sac5SiMw8bCsMIk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pdQJD0xj; 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="pdQJD0xj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 262F11F000FF; Sat, 12 Sep 2026 20:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789243467; bh=5IjqRFImLBvFLQfCqH4bYpn5pz6K5bmoV9ekUWhfaL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pdQJD0xjuAd/larBYnFvYNvnZ35ZNwGTR7yzFZ27YPy9QcL45jplrEh2fgCK5N7WC Gmv5+qvm6ZBbYCXcHSNy2Xcro+AXIsghG2VDLMwuWMv3ZEgiGeRcvzXHZsSbOYFsiR iv8aodeydWJ2WKGUOV/HciVh8xvXC6J3DfzgRqXc= 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 5.10 765/798] net/sched: sfq: clamp quantum to avoid signed overflow soft lockup Date: Sat, 12 Sep 2026 09:06:33 +0200 Message-ID: <20260912065534.602981319@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@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 5.10-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 4a10f794be588..7b81cd8a2ef03 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c @@ -793,7 +793,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