From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Matteo Croce <mcroce@redhat.com>
Cc: Timothy Redaelli <tredaelli@redhat.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2] vfat: don't read garbage after last dirent
Date: Mon, 24 Dec 2018 21:14:49 +0900 [thread overview]
Message-ID: <87zhsvi0jq.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20181216231510.26854-1-mcroce@redhat.com> (Matteo Croce's message of "Mon, 17 Dec 2018 00:15:10 +0100")
Matteo Croce <mcroce@redhat.com> writes:
> The FAT32 File System Specification[1] states that:
>
> If DIR_Name[0] == 0x00, then the directory entry is free, and there
> are no allocated directory entries after this one.
>
> The special 0 value, indicates to FAT file system driver code that
> the rest of the entries in this directory do not need to be examined
> because they are all free.
>
> This is not enforced by Linux, and is possible to read garbage if not
> all dirents after the last one are filled with zeroes.
>
> [1] http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/fatgen103.doc
>
> Reported-by: Timothy Redaelli <tredaelli@redhat.com>
> Signed-off-by: Matteo Croce <mcroce@redhat.com>
We have to handle all paths that is using fat_get_entry(), to make
consistent behavior.
With quick check, there are still several issues remaining. Please check
more. For example, looks like fat_parse_long()/fat_search_long() path is
missing, and fat_get_dotdot_entry(), fat_subdirs() too.
(while adding new entry, if we found zeroed entry, we would be better to
warn about fsck.)
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2018-12-24 12:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-16 23:15 Matteo Croce
2018-12-24 12:14 ` OGAWA Hirofumi [this message]
2018-12-26 20:45 ` Matteo Croce
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=87zhsvi0jq.fsf@mail.parknet.co.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcroce@redhat.com \
--cc=tredaelli@redhat.com \
/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
all inboxes | Powered by JetHome®