Re: [PATCH v3] md/raid5: reject raid4/5 arrays with too few disks

From: yu kuai

Date: Sat Sep 12 2026 - 07:54:36 EST


在 2026/9/11 12:15, Chen Cheng 写道:

> From: Chen Cheng<chencheng@xxxxxxxxx>
>
> raid4 and raid5 require at least two disks, while raid6 requires at least
> four disks. setup_conf() only rejects raid6 arrays with fewer than four
> disks. As a result, an invalid raid4 or raid5 array can be assembled with
> no data disks and later reach raid5_set_limits().
>
> Reject such arrays before the r5conf is created. This prevents the invalid
> geometry from reaching queue limit setup, where roundup_pow_of_two() can be
> called with a zero stripe size.
>
> Reported-by:syzbot+de94ddbfff0c9e6fe030@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes:https://lore.kernel.org/r/6a778c82.01d0871a.3a0d52.006a.GAE@xxxxxxxxxx/
> Fixes: f63f17350e53 ("md/raid5: use the atomic queue limit update APIs")
> Signed-off-by: Chen Cheng<chencheng@xxxxxxxxx>
> ---
> v1->v2:
> - Fix wrong tags
> - Check raid-4 also
>
> v2->v3:
> - Keep two-disk raid5 arrays valid by rejecting raid4/5 only below two disks
> ---
> drivers/md/raid5.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
Applied to md-7.3

--
Thanks,
Kuai