exfat: redefine DIR_DELETED as the bad cluster number
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CGME20221229115257epcas1p27195844dc54cf09608dad9967808530a@epcas1p2.samsung.com
Sungjong Seo
maintainerPATCH 1/1 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.
--- fs/exfat/exfat_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exfat/exfat_fs.h +1 -1
@@ -50,7 +50,7 @@ enum {#define ES_IDX_LAST_FILENAME (name_len) \ (ES_IDX_FIRST_FILENAME + EXFAT_FILENAME_ENTRY_NUM(name_len) - 1) -#define DIR_DELETED 0xFFFF0321 +#define DIR_DELETED 0xFFFFFFF7/* type values */ #define TYPE_UNUSED 0x0000
Signature · 1 line
2.25.1
2022-12-29 20:52 GMT+09:00, Sungjong Seo <[email protected]>:
Quoted 8 lines
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_DELETEDmust be one of invalid cluster numbers. According to the exFAT specification, a volume can have at most 2^32-11 clusters. However,DIR_DELETEDis wrongly defined as0xFFFF0321, which could be a valid cluster number. To fix it, let's redefineDIR_DELETEDas0xFFFFFFF7, the bad cluster number.
Quoted 5 lines
Fixes 1acf1a564b60 ("exfat: add in-memory and on-disk structures andheaders")
Reported-by Yuezhang Mo <[email protected]>Signed-off-by Sungjong Seo <[email protected]>
Applied, Thanks!