[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241126215254.aw7l7k3tgx2tawzu@quack3>
Date: Tue, 26 Nov 2024 22:52:54 +0100
From: Jan Kara <jack@...e.cz>
To: Leo Stone <leocstone@...il.com>
Cc: Jan Kara <jack@...e.cz>,
syzbot+2db3c7526ba68f4ea776@...kaller.appspotmail.com,
brauner@...nel.org, quic_jjohnson@...cinc.com,
viro@...iv.linux.org.uk, sandeen@...hat.com,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com, shuah@...nel.org,
anupnewsmail@...il.com,
linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] hfs: Sanity check the root record
On Tue 26-11-24 09:21:50, Leo Stone wrote:
> Hello,
>
> On Tue, Nov 26, 2024 at 10:33:13AM +0100, Jan Kara wrote:
> >
> > This certainly won't hurt but shouldn't we also add some stricter checks
> > for entry length so that we know we've loaded enough data to have full info
> > about the root dir?
>
> Yes, that would be a good idea. Do we want to keep the existing checks
> and just make sure we have at least enough to initialize the struct:
>
> if (fd.entrylength > sizeof(rec) || fd.entrylength < 0 ||
> fd.entrylength < sizeof(rec.dir)) {
> res = -EIO;
> goto bail_hfs_find;
> }
>
> Or be even stricter and only accept the exact length:
>
> if (fd.entrylength != sizeof(rec.dir)) {
> res = -EIO;
> goto bail_hfs_find;
> }
Yes, this strict check would make sense to me. I just don't know HFS good
enough whether this is a safe assumption to make so it would be good to
test with some HFS filesystem.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists