]> git.ipfire.org Git - thirdparty/linux.git/commit
f2fs: protect extension_list reading with sb_lock in f2fs_sbi_show()
authorYongpeng Yang <yangyongpeng@xiaomi.com>
Fri, 10 Apr 2026 15:05:39 +0000 (23:05 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 13 Apr 2026 22:53:00 +0000 (22:53 +0000)
commit5909bedbed38c558bee7cb6758ceedf9bc3a9194
tree06572a86ae25423f9165547d2d4c90a808b1a619
parentb8b902fd57fbaec70eb5ae2f0ec12a650ae62d96
f2fs: protect extension_list reading with sb_lock in f2fs_sbi_show()

In f2fs_sbi_show(), the extension_list, extension_count and
hot_ext_count are read without holding sbi->sb_lock. If a concurrent
sysfs store modifies the extension list via f2fs_update_extension_list(),
the show path may read inconsistent count and array contents, potentially
leading to out-of-bounds access or displaying stale data.

Fix this by holding sb_lock around the entire extension list read
and format operation.

Fixes: b6a06cbbb5f7 ("f2fs: support hot file extension")
Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/sysfs.c