[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yvflvdb63ohd4qqaynroebkhimqerlwy2jxsb3obhffg5mxq46@oafh3b6dlkjq>
Date: Mon, 8 Dec 2025 10:51:31 +0100
From: Jan Kara <jack@...e.cz>
To: Jori Koolstra <jkoolstra@...all.nl>
Cc: Jan Kara <jack@...e.cz>, Christian Brauner <brauner@...nel.org>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>, Taotao Chen <chentaotao@...iglobal.com>,
Shuah Khan <skhan@...uxfoundation.org>, linux-kernel@...r.kernel.org,
syzbot+5ad0824204c7bf9b67f2@...kaller.appspotmail.com
Subject: Re: [PATCH 2/3] minix: Add required sanity checking to
minix_check_superblock()
On Sun 07-12-25 19:36:44, Jori Koolstra wrote:
> > >
> > > diff --git a/fs/minix/inode.c b/fs/minix/inode.c
> > > index 7897f5123b3d..8eb26ff91adf 100644
> > > --- a/fs/minix/inode.c
> > > +++ b/fs/minix/inode.c
> > > @@ -171,7 +171,14 @@ static bool minix_check_superblock(struct super_block *sb)
> > > {
> > > struct minix_sb_info *sbi = minix_sb(sb);
> > >
> > > - if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0)
> > > + if (sbi->s_log_zone_size != 0) {
> > > + printk("minix-fs error: zone size must equal block size. "
> > > + "s_log_zone_size > 0 is not supported.\n");
> > > + return false;
> > > + }
> > > +
> > > + if (sbi->s_ninodes < 1 || sbi->s_firstdatazone <= 4 ||
> > > + sbi->s_firstdatazone >= sbi->s_nzones)
> > > return false;
> >
> > OK, but why did you remove the s_imap_blocks and s_zmap_blocks checks?
> >
>
> I replied to this a while ago that this already happens later in
> minix_fill_superblock:
> https://elixir.bootlin.com/linux/v6.18-rc7/source/fs/minix/inode.c#L280
>
> Maybe you missed it. Let me know if this answers your question when you
> have time.
True, a stricter check happens later in minix_fill_super() but AFAICS
minix_set_bit() calls before this stricter check will crash if
s_imap_blocks or s_zmap_blocks are zero. So I think the original check is
still needed.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists