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=1796380929; b=pY2dbrSAYR9RrCYn9c8W6hr/MLWC+vOwbt6SxiuIOjmeBSIbsiVIphbSH76w08U50k15 FlIGMom+nyNvRaBWRoH9Dxkn3cyr6y0lVeBAmpVqLjq5ItGlpuMRWDoRwo6a4ayySA3g6 Hb4IzBGpC5Yq0JSgu++ILLO8SqMxSgEBOowI8zsH0BZy8DYANAj1WkiEx4QiOmsi3++8A kjFGsFBhXyC5bMB1e2AMf5hFcYZbg2TUmQ42PjYiMqkKq44Du9W2Jvx6C/cie2u0qC0OZ TIzx2zG/U+VpJORLah/UbeSnJZnGpurRiEH4ZyDOuEJnl9zjm8jj8guzjjAXKAdYxJQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380929; 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=GkPXVN720BbabtqIsSWE+dzuBZZGor7AclwUwJXqKJY=; b=42+qvjRvC6VgrLZPBffubcZWBcbP9+0CCFJan5n368xcQuCPLVaKJdd02YgJ+QfH5CEP /DdkaeKZX1+1TGOjJ99zYejYkRGT+6M/Xzz9L3IdLNdJ97h6y6zuTynVluEw8trzDeTpd BYhqyElwKuJwN7OaNblP+2cwIdV6YT637owDPrXBe0/gdpC6RzVjJ1M7o/chYBEI04wTu oAdM8nRNGgPjWY3FNx1B4J2znNd3IqV2Q+1CqVEm8YlYiUP3hApS76gFeBC8BryrIcOqn HeDmvDwhtR4mbhyW4h+XpW+6Jkpjg10iwDtMWNYszbhNIqnU/EhVsTo1GCRlQqWbqbg== 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=K7YrJHmH; 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 A7DB6606A322; Fri, 4 Dec 2026 10:42:09 +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=K7YrJHmH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 215EF1F000C2; Fri, 4 Dec 2026 10:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380929; bh=GkPXVN720BbabtqIsSWE+dzuBZZGor7AclwUwJXqKJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=K7YrJHmHIXck/aeoGUEavncl9LTaD3fbNVJbJ3o1lV1b5pFaYewg58vWw7dV4jAGL nqSS3sSpfJBKAUQtH+7rsXxFT60FmskxTiLq9IDHEexZ20HctQSGvlJ5HxEleUYqfb eX+XYawmuk3/6xNJf9z8ClwhRgLIWIP6RhEPcXmY= 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 7.3 444/742] blk-iocost: Fix overflow in donation weight calculation Date: Fri, 4 Dec 2026 19:05:08 +0900 Message-ID: <20261204100646.946681339@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 @@ -1848,7 +1848,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); }