From: syzbot <syzbot+9e3014263a35700ab49b@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Forwarded: [PATCH] UBSAN: array-index-out-of-bounds in super_90_sync
Date: Mon, 14 Sep 2026 05:28:42 -0700 [thread overview]
Message-ID: <6aa7e87a.a211d2ce.1a5198.0293.GAE@google.com> (raw)
In-Reply-To: <6aa6a091.f670cee1.72fc4.0012.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] UBSAN: array-index-out-of-bounds in super_90_sync
Author: jchuang26@m.fudan.edu.cn
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2f0c1cf72f4682178506f513bbf015e591b1aa4a
Reported-by: syzbot+9e3014263a35700ab49b@syzkaller.appspotmail.com
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 680b34a63..1f84f2034 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1393,7 +1393,12 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
goto abort;
}
- if (sb->raid_disks <= 0)
+ /*
+ * The 0.90 superblock only has room for MD_SB_DISKS disk
+ * descriptors; a larger raid_disks would later make
+ * super_90_sync() index beyond the end of sb->disks[].
+ */
+ if (sb->raid_disks <= 0 || sb->raid_disks > MD_SB_DISKS)
goto abort;
if (md_csum_fold(calc_sb_csum(sb)) != md_csum_fold(sb->sb_csum)) {
@@ -7926,6 +7931,16 @@ int md_set_array_info(struct mddev *mddev, struct mdu_array_info_s *info)
mddev->ctime = ktime_get_real_seconds();
return 0;
}
+ /*
+ * A persistent (0.90) superblock can only describe MD_SB_DISKS
+ * devices. Reject negative or oversized raid_disks here so that
+ * super_90_sync() cannot index outside sb->disks[].
+ * Non-persistent arrays never write a superblock, so they are not
+ * limited by this on-disk format.
+ */
+ if (info->raid_disks < 0 ||
+ (!info->not_persistent && info->raid_disks > MD_SB_DISKS))
+ return -EINVAL;
mddev->major_version = MD_MAJOR_VERSION;
mddev->minor_version = MD_MINOR_VERSION;
mddev->patch_version = MD_PATCHLEVEL_VERSION;
prev parent reply other threads:[~2026-09-14 12:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 13:09 [syzbot] [raid?] " syzbot
2026-09-13 17:34 ` syzbot
2026-09-14 3:52 ` Forwarded: [PATCH] md: validate raid_disks against MD_SB_DISKS in super_90_load syzbot
2026-09-14 4:22 ` Forwarded: [PATCH] md: fix out-of-bounds access to superblock disk array syzbot
2026-09-14 7:44 ` Forwarded: [PATCH] configfs: unhash dentry before dropping the item syzbot
2026-09-14 12:28 ` syzbot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6aa7e87a.a211d2ce.1a5198.0293.GAE@google.com \
--to=syzbot+9e3014263a35700ab49b@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®