exfat: redefine DIR_DELETED as the bad cluster number
authorSungjong Seo <sj1557.seo@samsung.com>
Thu, 29 Dec 2022 11:52:38 +0000 (20:52 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:58 +0000 (09:39 +0100)
commit9717df94d7d04c922f5f9078848b9f45dedc824a
tree03ddd2f4dd618e2ae85dd4bf270b3562be66787b
parentc2c3d86bd4a99a9d0a4d2087574d71a8071ef245
exfat: redefine DIR_DELETED as the bad cluster number

commit bdaadfd343e3cba49ad0b009ff4b148dad0fa404 upstream.

When a file or a directory is deleted, the hint for the cluster of
its parent directory in its in-memory inode is set as DIR_DELETED.
Therefore, DIR_DELETED must be one of invalid cluster numbers. According
to the exFAT specification, a volume can have at most 2^32-11 clusters.
However, DIR_DELETED is wrongly defined as 0xFFFF0321, which could be
a valid cluster number. To fix it, let's redefine DIR_DELETED as
0xFFFFFFF7, the bad cluster number.

Fixes: 1acf1a564b60 ("exfat: add in-memory and on-disk structures and headers")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/exfat/exfat_fs.h