]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
exfat: fix incorrect directory checksum after rename to shorter name
authorChi Zhiling <chizhiling@kylinos.cn>
Fri, 3 Apr 2026 08:05:33 +0000 (16:05 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Fri, 3 Apr 2026 13:41:02 +0000 (22:41 +0900)
commitff37797badd831797b8a27830fe5046d7e23fdc3
tree52c5f36d2853b8b948a0054cf7a790e757423fb1
parent4129a3a2751cba8511cee5d13145223662a8e019
exfat: fix incorrect directory checksum after rename to shorter name

When renaming a file in-place to a shorter name, exfat_remove_entries
marks excess entries as DELETED, but es->num_entries is not updated
accordingly. As a result, exfat_update_dir_chksum iterates over the
deleted entries and computes an incorrect checksum.

This does not lead to persistent corruption because mark_inode_dirty()
is called afterward, and __exfat_write_inode later recomputes the
checksum using the correct num_entries value.

Fix by setting es->num_entries = num_entries in exfat_init_ext_entry.

Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/exfat/dir.c