diff options
| author | Alex Kazinsky <a.kazinsky@ideco.ru> | 2026-11-13 15:08:40 +0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-11-13 13:28:02 -0700 |
| commit | a56d5a485be4a9d52f0d7b3ed0dc3521367cb986 (patch) | |
| tree | 59a0711780b71df8b2ad9e9b75fec25e00430046 /kernel/debug/debug_core.h | |
| parent | 7cc2dda4f7aaf596c1796184649007151ff98f8d (diff) | |
blk-iocost: Fix overflow in donation weight calculation
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 <a.kazinsky@ideco.ru>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://patch.msgid.link/20261113110842.4189035-1-a.kazinsky@ideco.ru
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'kernel/debug/debug_core.h')
0 files changed, 0 insertions, 0 deletions
