From: "Namjae Jeon" <namjae.jeon@samsung.com>
To: <Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp>
Cc: <flrncrmr@gmail.com>, <stable@vger.kernel.org>,
<linux-fsdevel@vger.kernel.org>
Subject: RE: [PATCH] exfat: handle wrong stream entry size in exfat_readdir()
Date: Mon, 5 Jul 2021 16:35:46 +0900 [thread overview]
Message-ID: <004201d77170$5e9d6c50$1bd844f0$@samsung.com> (raw)
In-Reply-To: <OSAPR01MB45311389DB35CA9CEFEDCEF6901C9@OSAPR01MB4531.jpnprd01.prod.outlook.com>
> > The compatibility issue between linux exfat and exfat of some camera
> > company was reported from Florian. In their exfat, if the number of
> > files exceeds any limit, the DataLength in stream entry of the
> > directory is no longer updated. So some files created from camera does
> > not show in linux exfat. because linux exfat doesn't allow that cpos becomes larger than DataLength
> of stream entry. This patch check DataLength in stream entry only if the type is ALLOC_NO_FAT_CHAIN
> and add the check ensure that dentry offset does not exceed max dentries size(256 MB) to avoid the
> circular FAT chain issue.
>
> Instead of using fsd to handle this, shouldn't it be left to fsck?
Yes, That's what I thought at first. And fsck.exfat in exfatprogs can detect it like this.
$ fsck.exfat /dev/sdb1
exfatprogs version : 1.1.1
ERROR: /DCIM/344_FUJI: more clusters are allocated. truncate to 524288 bytes. Truncate (y/N)? n
>
> In the exfat specification says, the DataLength Field of the directory-stream is the entire size of
> the associated allocation.
> If the DataLength Field does not match the size in the FAT-chain, it means that it is corrupted.
Yes. I have checked it.
>
> As you know, the FAT-chain structure is fragile.
> At runtime, one way to detect a broken FAT-chain is to compare it with DataLength.
> (Detailed verification is the role of fsck).
> Ignoring DataLength during dir-scan is unsafe because we lose a way to detect a broken FAT-chain.
>
> I think fsd should check DataLength, and fsck should repair DataLength.
But Windows fsck doesn’t detect it and it shows the all files normally without any missing ones.
It means Windows exfat doesn't also check it in case type is ALLOC_FAT_CHAIN.
>
> As for the 256MB check, I think it would be better to have it.
>
> BR
> ---
> Kohada Tetsuhiro <Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp>
next prev parent reply other threads:[~2021-07-05 7:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210611004956epcas1p262dc7907165782173692d7cf9e571dfe@epcas1p2.samsung.com>
2021-06-11 0:40 ` [PATCH] exfat: handle wrong stream entry size in exfat_readdir() Namjae Jeon
2021-07-01 19:04 ` Chris Down
2021-07-01 23:34 ` Namjae Jeon
2021-07-05 7:04 ` Kohada.Tetsuhiro
2021-07-05 7:35 ` Namjae Jeon [this message]
2021-07-12 3:11 ` Kohada.Tetsuhiro
2021-07-15 9:39 ` Kohada.Tetsuhiro
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='004201d77170$5e9d6c50$1bd844f0$@samsung.com' \
--to=namjae.jeon@samsung.com \
--cc=Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp \
--cc=flrncrmr@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox