From: Matthew Wilcox <willy@infradead.org>
To: Egor Chelak <egor.chelak@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Arnd Bergmann <arnd@arndb.de>,
Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] isofs: fix High Sierra dirent flag accesses
Date: Mon, 22 Jun 2020 22:31:02 +0100 [thread overview]
Message-ID: <20200622213102.GD21350@casper.infradead.org> (raw)
In-Reply-To: <20200621040817.3388-1-egor.chelak@gmail.com>
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;
}
prev parent reply other threads:[~2020-06-22 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-21 4:08 [PATCH] isofs: fix High Sierra dirent flag accesses Egor Chelak
2020-06-22 21:22 ` Matthew Wilcox
2020-06-23 1:21 ` Egor Chelak
2020-06-22 21:31 ` Matthew Wilcox [this message]
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=20200622213102.GD21350@casper.infradead.org \
--to=willy@infradead.org \
--cc=arnd@arndb.de \
--cc=egor.chelak@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).