]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: prevent possible int overflow in dir_block_index()
authorNikita Zhandarovich <n.zhandarovich@fintech.ru>
Wed, 24 Jul 2024 17:05:44 +0000 (10:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:14 +0000 (15:11 +0200)
commitafb5da22a7fab9419cddee5265f073484c4a4b9d
tree5276de78c9e4929a7a8bd7539e56e50531ad957d
parent21f055191ea50a7384ba7b53f300e5db93891c86
f2fs: prevent possible int overflow in dir_block_index()

commit 47f268f33dff4a5e31541a990dc09f116f80e61c upstream.

The result of multiplication between values derived from functions
dir_buckets() and bucket_blocks() *could* technically reach
2^30 * 2^2 = 2^32.

While unlikely to happen, it is prudent to ensure that it will not
lead to integer overflow. Thus, use mul_u32_u32() as it's more
appropriate to mitigate the issue.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: 3843154598a0 ("f2fs: introduce large directory support")
Cc: stable@vger.kernel.org
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/dir.c