]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: avoid negative min_clusters in find_group_orlov()
authorKemeng Shi <shikemeng@huaweicloud.com>
Tue, 20 Aug 2024 13:22:30 +0000 (21:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:20 +0000 (16:29 +0200)
commit9f70768554acf61327fc8352bd5ae313a72d68c4
tree0a4a75db7155d5051e5b822c6ec92d35d0cab652
parentfae0793abdab022c0778a2440108e8cd7bb6d7d0
ext4: avoid negative min_clusters in find_group_orlov()

[ Upstream commit bb0a12c3439b10d88412fd3102df5b9a6e3cd6dc ]

min_clusters is signed integer and will be converted to unsigned
integer when compared with unsigned number stats.free_clusters.
If min_clusters is negative, it will be converted to a huge unsigned
value in which case all groups may not meet the actual desired free
clusters.
Set negative min_clusters to 0 to avoid unexpected behavior.

Fixes: ac27a0ec112a ("[PATCH] ext4: initial copy of files from ext3")
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Link: https://patch.msgid.link/20240820132234.2759926-4-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/ialloc.c