From: "Sungjong Seo" <sj1557.seo@samsung.com>
To: <Yuezhang.Mo@sony.com>, <linkinjeon@kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>, <Andy.Wu@sony.com>,
<Wataru.Aoyama@sony.com>, <cpgs@samsung.com>,
<sj1557.seo@samsung.com>
Subject: RE: [PATCH v2] exfat: zero the reserved fields of file and stream extension dentries
Date: Thu, 25 Apr 2024 15:15:09 +0900 [thread overview]
Message-ID: <664457955.21714026181854.JavaMail.epsvc@epcpadp4> (raw)
In-Reply-To: <PUZPR04MB6316FDC76BB5D2818276D39581172@PUZPR04MB6316.apcprd04.prod.outlook.com>
> From exFAT specification, the reserved fields should initialize
> to zero and should not use for any purpose.
>
> If create a new dentry set in the UNUSED dentries, all fields
> had been zeroed when allocating cluster to parent directory.
>
> But if create a new dentry set in the DELETED dentries, the
> reserved fields in file and stream extension dentries may be
> non-zero. Because only the valid bit of the type field of the
> dentry is cleared in exfat_remove_entries(), if the type of
> dentry is different from the original(For example, a dentry that
> was originally a file name dentry, then set to deleted dentry,
> and then set as a file dentry), the reserved fields is non-zero.
>
> So this commit initializes the dentry to 0 before createing file
> dentry and stream extension dentry.
>
> Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
> Reviewed-by: Andy Wu <Andy.Wu@sony.com>
> Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
Looks good. Thanks for your patch.
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
> ---
> fs/exfat/dir.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
> index 077944d3c2c0..84572e11cc05 100644
> --- a/fs/exfat/dir.c
> +++ b/fs/exfat/dir.c
> @@ -420,6 +420,7 @@ static void exfat_set_entry_type(struct exfat_dentry
> *ep, unsigned int type)
> static void exfat_init_stream_entry(struct exfat_dentry *ep,
> unsigned int start_clu, unsigned long long size)
> {
> + memset(ep, 0, sizeof(*ep));
> exfat_set_entry_type(ep, TYPE_STREAM);
> if (size == 0)
> ep->dentry.stream.flags = ALLOC_FAT_CHAIN;
> @@ -457,6 +458,7 @@ void exfat_init_dir_entry(struct exfat_entry_set_cache
> *es,
> struct exfat_dentry *ep;
>
> ep = exfat_get_dentry_cached(es, ES_IDX_FILE);
> + memset(ep, 0, sizeof(*ep));
> exfat_set_entry_type(ep, type);
> exfat_set_entry_time(sbi, ts,
> &ep->dentry.file.create_tz,
> --
> 2.34.1
next prev parent reply other threads:[~2024-04-25 6:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240425045525epcas1p1052d7d89d9ced86a34dbe5f6a7dcad39@epcas1p1.samsung.com>
2024-04-25 4:55 ` [PATCH v2] exfat: zero the reserved fields of file and stream extension dentries Yuezhang.Mo
2024-04-25 6:15 ` Sungjong Seo [this message]
2024-04-25 13:05 ` Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=664457955.21714026181854.JavaMail.epsvc@epcpadp4 \
--to=sj1557.seo@samsung.com \
--cc=Andy.Wu@sony.com \
--cc=Wataru.Aoyama@sony.com \
--cc=Yuezhang.Mo@sony.com \
--cc=cpgs@samsung.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.