[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20241104054435.291037-1-danielyangkang@gmail.com>
Date: Sun, 3 Nov 2024 21:44:34 -0800
From: Daniel Yang <danielyangkang@...il.com>
To: "GitAuthor: Daniel Yang" <danielyangkang@...il.com>,
linux-kernel@...r.kernel.org (open list)
Cc: syzbot+6a0633f11d3fb88860bf@...kaller.appspotmail.com
Subject: [PATCH] fix: divide error in qnx6_mmi_fill_super
Add a check for sb_blocksize before dividing.
Signed-off-by: Daniel Yang <danielyangkang@...il.com>
Reported-by: syzbot+6a0633f11d3fb88860bf@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6a0633f11d3fb88860bf
---
fs/qnx6/super_mmi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/qnx6/super_mmi.c b/fs/qnx6/super_mmi.c
index d282c2c73..57f34320b 100644
--- a/fs/qnx6/super_mmi.c
+++ b/fs/qnx6/super_mmi.c
@@ -65,8 +65,13 @@ struct qnx6_super_block *qnx6_mmi_fill_super(struct super_block *s, int silent)
}
/* calculate second superblock blocknumber */
+ __u32 sb1_blocksize = fs32_to_cpu(sbi, sb1->sb_blocksize);
+
+ if (!sb1_blocksize) {
+ pr_err("superblock #1 blocksize 0\n");
+ goto out;
+ }
offset = fs32_to_cpu(sbi, sb1->sb_num_blocks) + QNX6_SUPERBLOCK_AREA /
- fs32_to_cpu(sbi, sb1->sb_blocksize);
+ sb1_blocksize;
/* set new blocksize */
if (!sb_set_blocksize(s, fs32_to_cpu(sbi, sb1->sb_blocksize))) {
--
2.39.2
Powered by blists - more mailing lists