deepin-kernel/fs/exfat
Yuezhang Mo 114f1cba1a exfat: fix the infinite loop in exfat_find_last_cluster()
[ Upstream commit b0522303f6 ]

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>
(cherry picked from commit af089264d10823ce9c93962b33a3da9219b9cd75)
2025-04-14 15:49:28 +08:00
..
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile exfat: add Kconfig and Makefile 2020-03-05 21:00:40 -05:00
balloc.c exfat: fix soft lockup in exfat_clear_bitmap 2025-03-18 15:20:51 +08: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-19 12:48:46 +08:00
exfat_fs.h exfat: fix soft lockup in exfat_clear_bitmap 2025-03-18 15:20:51 +08:00
exfat_raw.h exfat: handle unreconized benign secondary entries 2023-02-27 21:14:46 +09:00
fatent.c exfat: fix the infinite loop in exfat_find_last_cluster() 2025-04-14 15:49:28 +08:00
file.c exfat: Implement sops->shutdown and ioctl 2024-12-10 20:43:51 +08:00
inode.c exfat: Implement sops->shutdown and ioctl 2024-12-10 20:43:51 +08: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-10 20:45:05 +08:00
nls.c exfat: Drop superfluous new line for error messages 2022-08-01 10:14:07 +09:00
super.c exfat: Implement sops->shutdown and ioctl 2024-12-10 20:43:51 +08:00