From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 73D2B3D3D06; Wed, 8 Apr 2026 18:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672013; cv=none; b=Dzi3DFB2X+7EaMc8ETV3mLAJOavhAkz7R+z3uRkRw7jZ8Gl1bfU8hWTbG5IbTbhCpKvEhQ1EmEkFmA7lp61dRCjDEpsLhPkzRhoKNaSYgmTz6gXbxm1LVrPD9tmzowq5i+rqp0rCtEfhfJ2kFwQ5Ikxc1ft3YD4avThXiXioJCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672013; c=relaxed/simple; bh=dE+4CUakmjqriWrFhic/Pzih7lB0VWoqJUQIX3QjtZw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rRrfK7WHN3pRSIHBci9YL0inTaV7ID93uX6h8jMr/wSD2H1HyziIBD1wmjd1sjME+/GOIBU2fvcJ/MNqGuecTzQoCcW/Fvahumr3cDVex5xZA8rKZ4C6Dq+6S3pKEZtdR0K7ra2QGMe9CfgmUXZE5p1Zsma8jMy3Qni5NnXt7AI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CSqv53JB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CSqv53JB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3CFFC19421; Wed, 8 Apr 2026 18:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775672013; bh=dE+4CUakmjqriWrFhic/Pzih7lB0VWoqJUQIX3QjtZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CSqv53JBD0yR+k4FxF2g4kfWsbgToZEBMkOEnU7gOs0vsMipZ1adiSmjycaJf+Tau ogXt+975dGzNvxDuKcwKkfCNYversR9WozJ3BJT7oxGG6mMf47rPSXUdv5lafIy93D g0kIN6cPLj8koe160a33LXwa7QjchHZZBI74rEK0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Weiming Shi , Xiang Mei , Jamal Hadi Salim , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 154/312] net/sched: sch_hfsc: fix divide-by-zero in rtsc_min() Date: Wed, 8 Apr 2026 20:01:11 +0200 Message-ID: <20260408175939.517036773@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175933.715315542@linuxfoundation.org> References: <20260408175933.715315542@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xiang Mei [ Upstream commit 4576100b8cd03118267513cafacde164b498b322 ] m2sm() converts a u32 slope to a u64 scaled value. For large inputs (e.g. m1=4000000000), the result can reach 2^32. rtsc_min() stores the difference of two such u64 values in a u32 variable `dsm` and uses it as a divisor. When the difference is exactly 2^32 the truncation yields zero, causing a divide-by-zero oops in the concave-curve intersection path: Oops: divide error: 0000 RIP: 0010:rtsc_min (net/sched/sch_hfsc.c:601) Call Trace: init_ed (net/sched/sch_hfsc.c:629) hfsc_enqueue (net/sched/sch_hfsc.c:1569) [...] Widen `dsm` to u64 and replace do_div() with div64_u64() so the full difference is preserved. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Weiming Shi Signed-off-by: Xiang Mei Acked-by: Jamal Hadi Salim Link: https://patch.msgid.link/20260326204310.1549327-1-xmei5@asu.edu Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_hfsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 302413e0aceff..a01ff859cc03b 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -556,7 +556,7 @@ static void rtsc_min(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y) { u64 y1, y2, dx, dy; - u32 dsm; + u64 dsm; if (isc->sm1 <= isc->sm2) { /* service curve is convex */ @@ -599,7 +599,7 @@ rtsc_min(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y) */ dx = (y1 - y) << SM_SHIFT; dsm = isc->sm1 - isc->sm2; - do_div(dx, dsm); + dx = div64_u64(dx, dsm); /* * check if (x, y1) belongs to the 1st segment of rtsc. * if so, add the offset. -- 2.53.0