sst-linux/fs/exfat
Yuezhang Mo 83048539a7 exfat: fix the infinite loop in exfat_find_last_cluster()
[ Upstream commit b0522303f67255926b946aa66885a0104d1b2980 ]

In exfat_find_last_cluster(), the cluster chain is traversed until
the EOF cluster. If the cluster chain includes a loop due to file
system corruption, the EOF cluster cannot be traversed, resulting
in an infinite loop.

If the number of clusters indicated by the file size is inconsistent
with the cluster chain length, exfat_find_last_cluster() will return
an error, so if this inconsistency is found, the traversal can be
aborted without traversing to the EOF cluster.

Reported-by: syzbot+f7d147e6db52b1e09dba@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f7d147e6db52b1e09dba
Tested-by: syzbot+f7d147e6db52b1e09dba@syzkaller.appspotmail.com
Fixes: 31023864e6 ("exfat: add fat entry operations")
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-04-10 14:33:37 +02:00
..
balloc.c exfat: fix soft lockup in exfat_clear_bitmap 2025-03-13 12:53:18 +01:00
cache.c exfat: fix use of uninitialized spinlock on error path 2020-10-07 14:27:13 +09:00
dir.c exfat: fix the infinite loop in exfat_readdir() 2025-01-17 13:34:37 +01:00
exfat_fs.h exfat: fix soft lockup in exfat_clear_bitmap 2025-03-13 12:53:18 +01:00
exfat_raw.h exfat: fix shift-out-of-bounds in exfat_fill_super() 2021-02-22 09:55:13 +09:00
fatent.c exfat: fix the infinite loop in exfat_find_last_cluster() 2025-04-10 14:33:37 +02:00
file.c exfat: fix inode->i_blocks for non-512 byte sector size device 2023-03-10 09:34:08 +01:00
inode.c exfat: fix inode->i_blocks for non-512 byte sector size device 2023-03-10 09:34:08 +01:00
Kconfig exfat: Improve wording of EXFAT_DEFAULT_IOCHARSET config option 2020-06-09 16:48:39 +09:00
Makefile exfat: add Kconfig and Makefile 2020-03-05 21:00:40 -05:00
misc.c exfat: Expand exfat_err() and co directly to pr_*() macro 2022-08-01 10:14:07 +09:00
namei.c exfat: fix uninit-value in __exfat_get_dentry_set 2024-12-14 19:54:00 +01:00
nls.c exfat: Drop superfluous new line for error messages 2022-08-01 10:14:07 +09:00
super.c exfat: fix inode->i_blocks for non-512 byte sector size device 2023-03-10 09:34:08 +01:00