]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
exfat: fix the infinite loop in __exfat_free_cluster()
authorYuezhang Mo <Yuezhang.Mo@sony.com>
Mon, 16 Dec 2024 05:39:42 +0000 (13:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2025 12:34:37 +0000 (13:34 +0100)
commitd23f2621fc550127a2436012fea6124dabe8bbff
tree34f93d74fce38fa63454891a7a3458dacc07bc79
parent31beabd0f47f8c3ed9965ba861c9e5b252d4920a
exfat: fix the infinite loop in __exfat_free_cluster()

[ Upstream commit a5324b3a488d883aa2d42f72260054e87d0940a0 ]

In __exfat_free_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.

This commit uses the total number of clusters to prevent this infinite
loop.

Reported-by: syzbot+1de5a37cb85a2d536330@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1de5a37cb85a2d536330
Tested-by: syzbot+1de5a37cb85a2d536330@syzkaller.appspotmail.com
Fixes: 31023864e67a ("exfat: add fat entry operations")
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/exfat/fatent.c