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=1796383784; b=yYa8LkqI/zogMFHGpRAGeOvCamcDcl/2RxgucVzPQn0/WpsD/8X2RDwrcblJhUoIMl+Z cfX4Ev480V5JIoY8PI0ktWm1WgmCM/YQnT6iF4nVFaabccu568VR+LpWHA6liZVahCYah SEoAcikbyo8DeeM6hNnB1fA2ae+OFOgqhVfcth/F7sjOVeU223+eq6sz183zmuABRhA2x vNbafTtrzgNmr7ZE7vFSm8Jmg9W9DH5j+JCtxmrQ5Y5w5dsdUhgZy5UTKNSpc9JM7enh/ o8NmtnICWJ5biRW9KMtpq7cXBy0DP5RdgDb/oQ6684Wjxehn1jhG/cX6qi5qxAkJvpQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383784; 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=VIaOPyg1ceF/fw9FIKZAnuhh/PDZIkcjo9zRYGVgYHE=; b=NEZC+zylOovxD6t/8GBJpFSmlgroT3mqEA9VoJK8SNCl9wYJ3ntQvy4IAzVDln1cDan/ psvetdoCw19kPt0I4swyUNj+pczRNe6ZwxW47uoMMlZFhQdgLHBasehsZzCiyaw87XWvJ 85O+wiKCcGFUs5JnfpcMt6RiaWSE5Px/8xnck9LgxICrdyJOKZAtk3K4q65ijwAxDtoyL WIR2MdGaE4oJrs83ELCw8aTvrg0ZgTaPcxTZ7RBXaW+M7GO3+1+2sOhYjl75sn2u/uBs2 Gn76Lg7osYoXJZ+Y6xsdABJuBjGZlgeIuBcnmZoS9mfCGF9iL+Fk56ZZC5NY0lA9UvQ== 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=0h31hAJt; 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 90C24606A322; Fri, 4 Dec 2026 11:29:44 +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=0h31hAJt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 014661F000CE; Fri, 4 Dec 2026 11:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383784; bh=VIaOPyg1ceF/fw9FIKZAnuhh/PDZIkcjo9zRYGVgYHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0h31hAJtoYMIskfps8CiXIkXixtyi1bi7ISZQq4CXAgATYJ3DJBJa7X/EFzpozTc6 odZUfxQCnv3AjaBmqzMDWR0Do5Vr8QUX6QQA+LG4y31uiGNoiU6SdiDN/GGPcYGe7H 3ziZ9PYHo6ldkcqSmExTZurb7LphNeuCw8djw+wI= 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.12 364/555] blk-iocost: Fix overflow in donation weight calculation Date: Fri, 4 Dec 2026 19:06:47 +0900 Message-ID: <20261204100623.828490202@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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.12-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 @@ -1845,7 +1845,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); }