[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200622213102.GD21350@casper.infradead.org>
Date: Mon, 22 Jun 2020 22:31:02 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Egor Chelak <egor.chelak@...il.com>
Cc: Al Viro <viro@...iv.linux.org.uk>, Arnd Bergmann <arnd@...db.de>,
Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] isofs: fix High Sierra dirent flag accesses
On Sun, Jun 21, 2020 at 07:08:17AM +0300, Egor Chelak wrote:
> The flags byte of the dirent was accessed as de->flags[0] in a couple of
> places, and not as de->flags[-sbi->s_high_sierra], which is how it's
> accessed elsewhere. This caused a bug, where some files on an HSF disc
> could be inaccessible.
>
> For context, here is the difference between HSF dirents and ISO dirents:
> Offset | High Sierra | ISO-9660 | struct iso_directory_record
> Byte 24 | Flags | mtime timezone | de->date[6] (de->flags[-1])
> Byte 25 | Reserved | Flags | de->flags[0]
Also, ew. Why on earth do we do 'de->flags[-sbi->s_high_sierra]'?
I'm surprised we don't have any tools that warn about references outside
an array. I would do this as ...
static inline u8 de_flags(struct isofs_sb_info *sbi,
struct iso_directory_record *de)
{
if (sbi->s_high_sierra)
return de->date[6];
return de->flags;
}
Powered by blists - more mailing lists