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 ACF773876C5; Sat, 12 Sep 2026 09:26:05 +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=1789205166; cv=none; b=NfBNhRStElq5oz3pkhz7QINNinwTX3/Ju2hC7HQz0MVWKV6dUPTCXQ3YTD37uWtuTHBRm9UABfwVqO8qvdqNWML0upd++sMty6syJbLLwWJrcV/UjAzcqo64NbJh5O+0Up2UuiOjPa3nC/DxpCmCHf+ezJdDa6KIAtTADL/QCnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789205166; c=relaxed/simple; bh=2eaW1TZUSSOwBCPpfPajy52z0vWmviI2cZbyUYB2Ivs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YY5hntmeHcFtmjH0KTYvgIazqBeVlOIdxfMIXo4SaEgaFGbgQynk0W0XOqSCpaXknswAeNrVCg5A2DnsKut3DMvl2c3aNkS6y+wEOH6IESSOpl9Qazg316TQ21f2INPcM7l3cnaTuz+KZFpKEgRDh/nVg7HSuAlzTUhcmdWySKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rIQfsZYB; 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="rIQfsZYB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5F2E1F00893; Sat, 12 Sep 2026 09:26:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789205165; bh=Ca72jFJMhW2jQDQ+aKl9AW6MatW2JIEglw4tPIdLH78=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rIQfsZYB4MYP0xnpd5aH0XEcoM6RHPW27eD8jfAJICILbobyZwe5RknQ/j8Xf79Wb NU4LhrlCD51m6FbQjhZtO1/wVyFVPeO/4iEQ1L+kQ2xAiUo6uucF/+GCZQPD0S5Yi1 o8oyFNU7g9SvWjSrgrBbAV3Sjfr6QcOOQileyJvk= 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 7.2 1762/1815] net/sched: hhf: clamp quantum before hhf_change() to avoid overflow Date: Sat, 12 Sep 2026 08:58:32 +0200 Message-ID: <20260912065730.355664375@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065648.999753832@linuxfoundation.org> References: <20260912065648.999753832@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jamal Hadi Salim [ Upstream commit 2164b512b97bb053e8ce4d6e95576f11bed6a005 ] hhf_init() sets q->quantum = psched_mtu(qdisc_dev(sch)) with no overflow check. A device with a huge MTU (e.g. dummy with max_mtu == 0 accepting MTU 2147483634) makes weight * quantum overflow the signed deficit in hhf_dequeue(), spinning forever. Clamp q->quantum before hhf_change() so both the opt and !opt paths see a sane quantum. Without this, bare "tc qdisc add ... hhf" succeeds with a clamped quantum but "tc qdisc add ... hhf limit 1000" (any option present) fails with -EINVAL because hhf_change() re-validates the unclamped default (sch_hhf.c:559). 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: 10239edf86f1 ("net-qdisc-hhf: Heavy-Hitter Filter (HHF) qdisc") Reported-by: vega@nebusec.ai Tested-by: Victor Nogueira Signed-off-by: Jamal Hadi Salim Link: https://patch.msgid.link/20260822195509.112717-6-jhs@mojatatu.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/sched/sch_hhf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c index d85cb0263b675..96acab6a8da03 100644 --- a/net/sched/sch_hhf.c +++ b/net/sched/sch_hhf.c @@ -624,6 +624,10 @@ static int hhf_init(struct Qdisc *sch, struct nlattr *opt, q->hhf_evict_timeout = HZ; /* 1 sec */ q->hhf_non_hh_weight = 2; + if ((int)q->quantum <= 0 || + (u64)q->quantum * q->hhf_non_hh_weight > INT_MAX) + q->quantum = 256; + if (opt) { int err = hhf_change(sch, opt, extack); -- 2.53.0