From: "Chen Cheng" <chencheng@fnnas.com>
To: <linux-raid@vger.kernel.org>, <yukuai@fygo.io>
Cc: <chencheng@fnnas.com>, <linux-kernel@vger.kernel.org>,
<syzbot+de94ddbfff0c9e6fe030@syzkaller.appspotmail.com>
Subject: [PATCH] md/raid5: fail invalid raid5_set_limits() geometry
Date: Tue, 11 Aug 2026 18:14:36 +0800 [thread overview]
Message-ID: <20260811101436.458181-1-chencheng@fnnas.com> (raw)
From: Chen Cheng <chencheng@fnnas.com>
Prevent raid5_set_limits() from building a stripe size when the array
geometry reports no data disks.
Reported-by: syzbot+de94ddbfff0c9e6fe030@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=de94ddbfff0c9e6fe030
Fixes: f63f17350e537300312 ("md/raid5: use the atomic queue limit update APIs")
Signed-off-by: Chen Cheng <chencheng@fnnas.com>
---
drivers/md/raid5.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ffb5fcde54a9..c0adb73b1dd4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7825,10 +7825,12 @@ static int raid5_set_limits(struct mddev *mddev)
/*
* The read-ahead size must cover two whole stripes, which is
* 2 * (datadisks) * chunksize where 'n' is the number of raid devices.
*/
data_disks = conf->previous_raid_disks - conf->max_degraded;
+ if (data_disks <= 0)
+ return -EINVAL;
/*
* We can only discard a whole stripe. It doesn't make sense to
* discard data disk but write parity disk
*/
--
2.55.0
reply other threads:[~2026-08-11 10:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260811101436.458181-1-chencheng@fnnas.com \
--to=chencheng@fnnas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=syzbot+de94ddbfff0c9e6fe030@syzkaller.appspotmail.com \
--cc=yukuai@fygo.io \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.