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 01D7E3D9DBB; Wed, 8 Apr 2026 18:23:18 +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=1775672598; cv=none; b=QEHapzxCEztmIkvYIkpbm2KP2Mv0XOYmnMqllwgLO1xPuiSGL50oMi5K9EDrFt9IK2sTh7rAPHlxUiAWCk+/xYD4TjNsFW1Gfxp1bxUByGRNJxMhaC5mhcQjyM+Mzmk8ZexlX+Q14LioJ3OfYeTqPYJz+W5H8uaMUmbpsaFDPYM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672598; c=relaxed/simple; bh=XOeCy5jYLYQeXQNJ3PdgIgSFqoMQwJQFtt6YpKcW4Vs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XWW8FKcQmnHf3YL74Im2YBur2F6ABqw58Df9THHhio1z9I/23Y8cUtj0Wvo5BO66IOCuNeQwfNkffJG/GXFQu+Jkve23r4aQArT4EE7cOscxjtA53vmt7Ky5vVx44hDuN8QW7g5AcOIfrdXeEwZ8qPhHz1TpGwNE4XWIS2OT/0I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lJzG7fxI; 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="lJzG7fxI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A210C19421; Wed, 8 Apr 2026 18:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775672597; bh=XOeCy5jYLYQeXQNJ3PdgIgSFqoMQwJQFtt6YpKcW4Vs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJzG7fxI2O5cgttzAjiqzuKJbQ5mPUfuwoOXTBaak8KcFbzVp3MYcpHTxQcssJhFL iutxPvi28h4rdx+3Z6XIt4gxY74qOPVYgZAo0kpexNVov1LQN6rPMEqIFXbWN+tsh/ kWJcj9KBY3LRJY0gl6vQkltJPYae/q5HRV5HlB18= 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.6 026/160] net/sched: sch_hfsc: fix divide-by-zero in rtsc_min() Date: Wed, 8 Apr 2026 20:01:53 +0200 Message-ID: <20260408175914.186503534@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175913.177092714@linuxfoundation.org> References: <20260408175913.177092714@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.6-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 751b1e2c35b3f..1ac51d0249919 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -555,7 +555,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 */ @@ -598,7 +598,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