Re: [PATCH 2/3] Add required sanity checking to minix_check_superblock()
From: Jan Kara
Date: Mon Nov 24 2025 - 12:31:45 EST
On Mon 17-11-25 23:05:21, Jori Koolstra wrote:
> The fs/minix implementation of the minix filesystem does not currently
> support any other value for s_log_zone_size than 0. This is also the
> only value supported in util-linux; see mkfs.minix.c line 511. In
> addition, this patch adds some sanity checking for the other minix
> superblock fields.
>
> This also closes a related syzbot bug report.
>
> Signed-off-by: Jori Koolstra <jkoolstra@xxxxxxxxx>
> Reported-by: syzbot+5ad0824204c7bf9b67f2@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=5ad0824204c7bf9b67f2
> ---
> fs/minix/inode.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> 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?
Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR