From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389248; b=1csyAI9jVaEKTjjb7RafKHkWHqV5N7xh/FxKmPIeUcCAoqO6Kswy8OGpGLer2PkHqnQz DybWz+lM6Mbz+8rMKx/OWkjWzZP93dZIXKCAu1I/MqUsIXrUYUvbOR1Cc+zKzzDapxRZO P7ko+/Rp3brRVjWr4DopFzdyHC8VOHMsBjHjhoH1nKVeTt1YnYQkjoWS6sK/1pB6tigJB u5uYctelbMADGVbvlp46Vmywvzsvyy/6faT/11VAHrI4tBFpUaoNzzqZxzRaJvqHt3mk7 410zfTUF0XMJsrJG4GJzlLnGdplTVEV9gx8YxxRBzJpIx/+KZ9uCX20ZXOtYUjMe1wA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389248; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=lzNz9OmpgtO30oTrcPEOWm2++mhJTNgEfF1ZJMXy3c0=; b=NObqB2cmEUwVXYEK8x1fxmSHzkxPIZcPMwHVl3uXI82OyBsaMJ45RyzNU3+C87C5v7Qd mRVf4vZRVEur1jh/YdzTGnACWGjAxWHCnGhzl240y62em0g8lf4GeriEzzLSnaAkRjnXk U9EQ1dfmab81/Pks+7AGmnwXq/QDY3TVnVMvHnsHhuI2S2x5TR/I94cDauGURIjQ/x5AC mEIrk3tTCkqqwg2ghaAc0Xck3EXP3nUNpnUlvWaCuPD1GPd0PBpRdbhzRxP4pgNYBo3cj gmL6m0qMw9Ygif53hRyu99cA1IICAx/uy5W5dtKP1P3rpDto/Z6+/xkkfiuHALiNaHQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UP7m6pGZ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE95F606A322; Fri, 4 Dec 2026 13:00:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UP7m6pGZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C5EF1F0092C; Fri, 4 Dec 2026 13:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389248; bh=lzNz9OmpgtO30oTrcPEOWm2++mhJTNgEfF1ZJMXy3c0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UP7m6pGZa1+Q1pyGQLxCbRpunnSYgHKxT8ZjkDhhmMuPUOd6tYzysAdoqFvADLav2 zDJvaBR8TL9xZxtFzN0sU2uK3YTuSl+qzZ70WzojucZ2Xi6hajQ1Scqz2BEC8SiLFp 35xwHKJ8N2mwJsHuxaZt4mPn1rN+gVk6sh0x+0M4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alex Kazinsky , Tejun Heo , Jens Axboe Subject: [PATCH 6.1 0920/1059] blk-iocost: Fix overflow in donation weight calculation Date: Fri, 4 Dec 2026 19:07:31 +0900 Message-ID: <20261204100707.853956989@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Kazinsky commit a56d5a485be4a9d52f0d7b3ed0dc3521367cb986 upstream. hweight_after_donation() receives usage as u32, clamped to the range [1, WEIGHT_ONE]. Since WEIGHT_ONE is 1 << 16, multiplying it by usage equal to WEIGHT_ONE wraps the 32-bit unsigned result to zero before it is passed to div64_s64(). This makes new_hwi zero, which is then clamped to 1, incorrectly reducing the cgroup's in-use weight to the minimum. Cast WEIGHT_ONE to s64 before multiplication to preserve the full product. Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool. Fixes: f1de2439ec43 ("blk-iocost: revamp donation amount determination") Cc: stable@vger.kernel.org Signed-off-by: Alex Kazinsky Acked-by: Tejun Heo Link: https://patch.msgid.link/20261113110842.4189035-1-a.kazinsky@ideco.ru Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-iocost.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -1841,7 +1841,8 @@ static u32 hweight_after_donation(struct delta = div64_s64(WEIGHT_ONE * (now->vnow - vtime), now->vnow - ioc->period_at_vtime); target = WEIGHT_ONE * MARGIN_TARGET_PCT / 100; - new_hwi = div64_s64(WEIGHT_ONE * usage, WEIGHT_ONE - target + delta); + new_hwi = div64_s64((s64)WEIGHT_ONE * usage, + WEIGHT_ONE - target + delta); return clamp_t(s64, new_hwi, 1, hwm); }