[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251117220522.4064487-2-jkoolstra@xs4all.nl>
Date: Mon, 17 Nov 2025 23:05:21 +0100
From: Jori Koolstra <jkoolstra@...all.nl>
To: Christian Brauner <brauner@...nel.org>
Cc: Jori Koolstra <jkoolstra@...all.nl>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
Jan Kara <jack@...e.cz>,
Taotao Chen <chentaotao@...iglobal.com>,
Shuah Khan <skhan@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
syzbot+5ad0824204c7bf9b67f2@...kaller.appspotmail.com
Subject: [PATCH 2/3] Add required sanity checking to minix_check_superblock()
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@...all.nl>
Reported-by: syzbot+5ad0824204c7bf9b67f2@...kaller.appspotmail.com
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;
/*
--
2.51.2
Powered by blists - more mailing lists