linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exfat: redefine DIR_DELETED as the bad cluster number
       [not found] <CGME20221229115257epcas1p27195844dc54cf09608dad9967808530a@epcas1p2.samsung.com>
@ 2022-12-29 11:52 ` Sungjong Seo
  2023-01-08  1:06   ` Namjae Jeon
  0 siblings, 1 reply; 2+ messages in thread
From: Sungjong Seo @ 2022-12-29 11:52 UTC (permalink / raw)
  To: linkinjeon
  Cc: pali, viro, linux-fsdevel, linux-kernel, Sungjong Seo,
	Yuezhang Mo

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")

Reported-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
---
 fs/exfat/exfat_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
index bc6d21d7c5ad..25a5df0fdfe0 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -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
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] exfat: redefine DIR_DELETED as the bad cluster number
  2022-12-29 11:52 ` [PATCH] exfat: redefine DIR_DELETED as the bad cluster number Sungjong Seo
@ 2023-01-08  1:06   ` Namjae Jeon
  0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2023-01-08  1:06 UTC (permalink / raw)
  To: Sungjong Seo; +Cc: pali, viro, linux-fsdevel, linux-kernel, Yuezhang Mo

2022-12-29 20:52 GMT+09:00, Sungjong Seo <sj1557.seo@samsung.com>:
> 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")
>
> Reported-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
> Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
Applied, Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-08  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20221229115257epcas1p27195844dc54cf09608dad9967808530a@epcas1p2.samsung.com>
2022-12-29 11:52 ` [PATCH] exfat: redefine DIR_DELETED as the bad cluster number Sungjong Seo
2023-01-08  1:06   ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).