Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

exfat: redefine DIR_DELETED as the bad cluster number

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>

authored by

Sungjong Seo and committed by
Namjae Jeon
bdaadfd3 706fdcac

+1 -1
+1 -1
fs/exfat/exfat_fs.h
··· 50 50 #define ES_IDX_LAST_FILENAME(name_len) \ 51 51 (ES_IDX_FIRST_FILENAME + EXFAT_FILENAME_ENTRY_NUM(name_len) - 1) 52 52 53 - #define DIR_DELETED 0xFFFF0321 53 + #define DIR_DELETED 0xFFFFFFF7 54 54 55 55 /* type values */ 56 56 #define TYPE_UNUSED 0x0000