linux-kernelorg-stable/fs/exfat
Yuezhang Mo aa8fe7b7b7 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:30:47 +02:00
..
Kconfig
Makefile
balloc.c exfat: fix soft lockup in exfat_clear_bitmap 2025-03-13 13:02:08 +01: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:30:47 +02:00
exfat_fs.h exfat: fix soft lockup in exfat_clear_bitmap 2025-03-13 13:02:08 +01: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:30:47 +02:00
file.c exfat: fdatasync flag should be same like generic_write_sync() 2025-08-15 12:14:02 +02:00
inode.c exfat: call bh_read in get_block only when necessary 2025-05-29 11:02:03 +02:00
misc.c
namei.c exfat: add cluster chain loop check for dir 2025-08-20 18:30:47 +02:00
nls.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
super.c exfat: add cluster chain loop check for dir 2025-08-20 18:30:47 +02:00