linux-yocto/fs/exfat
Yuezhang Mo 4c3cda20c4 exfat: add cluster chain loop check for dir
[ Upstream commit 99f9a97dce ]

An infinite loop may occur if the following conditions occur due to
file system corruption.

(1) Condition for exfat_count_dir_entries() to loop infinitely.
    - The cluster chain includes a loop.
    - There is no UNUSED entry in the cluster chain.

(2) Condition for exfat_create_upcase_table() to loop infinitely.
    - The cluster chain of the root directory includes a loop.
    - There are no UNUSED entry and up-case table entry in the cluster
      chain of the root directory.

(3) Condition for exfat_load_bitmap() to loop infinitely.
    - The cluster chain of the root directory includes a loop.
    - There are no UNUSED entry and bitmap entry in the cluster chain
      of the root directory.

(4) Condition for exfat_find_dir_entry() to loop infinitely.
    - The cluster chain includes a loop.
    - The unused directory entries were exhausted by some operation.

(5) Condition for exfat_check_dir_empty() to loop infinitely.
    - The cluster chain includes a loop.
    - The unused directory entries were exhausted by some operation.
    - All files and sub-directories under the directory are deleted.

This commit adds checks to break the above infinite loop.

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-20 18:41:29 +02:00
..
balloc.c exfat: support batch discard of clusters when freeing clusters 2025-03-27 21:18:02 +09:00
cache.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
dir.c exfat: add cluster chain loop check for dir 2025-08-20 18:41:29 +02:00
exfat_fs.h exfat: remove count used cluster from exfat_statfs() 2025-03-27 21:18:02 +09:00
exfat_raw.h exfat: add ioctls for accessing attributes 2023-10-31 10:00:51 +09:00
fatent.c exfat: add cluster chain loop check for dir 2025-08-20 18:41:29 +02:00
file.c exfat: fdatasync flag should be same like generic_write_sync() 2025-08-15 16:39:19 +02:00
inode.c exfat: call bh_read in get_block only when necessary 2025-03-29 22:03:11 +09:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile
misc.c exfat: convert to new timestamp accessors 2023-10-18 13:26:21 +02:00
namei.c exfat: add cluster chain loop check for dir 2025-08-20 18:41:29 +02:00
nls.c exfat: fix double free in delayed_free 2025-05-26 20:25:23 +09:00
super.c exfat: add cluster chain loop check for dir 2025-08-20 18:41:29 +02:00