[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGnkfhz8pc9UO5Y3NHMFowcMAeNnF3QApvh0N0MhLgRP2Y95FA@mail.gmail.com>
Date: Wed, 26 Dec 2018 21:45:24 +0100
From: Matteo Croce <mcroce@...hat.com>
To: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Cc: Timothy Redaelli <tredaelli@...hat.com>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2] vfat: don't read garbage after last dirent
On Mon, Dec 24, 2018 at 1:14 PM OGAWA Hirofumi
<hirofumi@...l.parknet.co.jp> wrote:
>
> Matteo Croce <mcroce@...hat.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@...hat.com>
> > Signed-off-by: Matteo Croce <mcroce@...hat.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.
>
If I put the check in fat_get_short_entry(), then
fat_get_dotdot_entry() and fat_subdirs() are covered too.
Is there any drawback in doing this?
> (while adding new entry, if we found zeroed entry, we would be better to
> warn about fsck.)
>
Ok
> Thanks.
> --
> OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Thanks,
--
Matteo Croce
per aspera ad upstream
Powered by blists - more mailing lists