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 EAB0B2F7F17; Sat, 12 Sep 2026 19:16:32 +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=1789240594; cv=none; b=uhbuA9rBc0/LV5eGENFDl5NumRxUM6FyKXThr/qHckkgNCgv5GtPfMuDfX883SdYhyinP3OzcXUkASj3k0OrubGS/9N8UGbdYNceUPVvfcr910f24BFESLOU9O9DQoDBjtc/yMCF0+dxrHwKbCh7S30uzzgHgNSpbw1OTqdApnM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789240594; c=relaxed/simple; bh=knfE5eM4p1uqU9ZNwsu6GZXxC3jfpGj25maJlz9Rdeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lXUNgi0bOiC+E3JYm1GvEvxMfOseCpgM0C7ykRfCTCcTh2AspADA15cvvK/NEMB3whP0v41VvFEpwQEjURR9ZjIs9YR3YhaKBWHvelnYQJOpGDNbql1b9rmvtGAWvK7FSLtAgwecoRyIKOQWX+1dwectNU1n2MJcVsMRVctr/mE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fFgEQYm0; 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="fFgEQYm0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E8621F000FF; Sat, 12 Sep 2026 19:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789240592; bh=FGweVkYtUUjEmydvWWx+5xgD74sr+0u0ZS1I881+Tp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fFgEQYm0NIpGI5Uu6d/04bdTFmx9700muttM+mIPKy9Ffg7ppQv15aB6WLXeAjFlm U5GUBol7GVUZ8LzMrMYjTw4V94B0dRLJ/AOxnIxxjpQny03ptEOQdf/K/Dv89di7sV 8vNkOx1+bEp1Vj2bU7OGhg29WdfgmEiYEkOTIdXA= 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.15 898/935] net/sched: sfq: clamp quantum to avoid signed overflow soft lockup Date: Sat, 12 Sep 2026 09:05:28 +0200 Message-ID: <20260912065547.410503652@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@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.15-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 cd089c3b226a7..8ca88a4fedd0f 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