Re: [PATCH v3] md/raid0: validate device count before allocating devlist

From: yu kuai

Date: Fri Sep 11 2026 - 23:51:26 EST


在 2026/9/7 21:29, Chandradhar Kumar 写道:

> create_strip_zones() allocates conf->devlist based on mddev->raid_disks
> before verifying that number of devices matches raid_disks. Move the
> existing device count validation before allocation to reject invalid
> configurations before attempting a potentially excessive allocation.
>
> Fixes: 078d1d8e688d ("md/raid0: use kvzalloc/kvfree for strip_zone and devlist allocations")
> Reported-by:syzbot+a32ff75e417c0f49a8e9@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes:https://syzbot.org/bug?extid=a32ff75e417c0f49a8e9
> Signed-off-by: Chandradhar Kumar<chandradhar.2003@xxxxxxxxx>
> ---
> v2 -> v3:
> - Move the existing device count validation before the allocation
> - Add the requested fixes tag
>
> v1:https://lore.kernel.org/all/20260906143928.105165-1-chandradhar.2003@xxxxxxxxx/
> v2:https://lore.kernel.org/all/20260906184406.2141-1-chandradhar.2003@xxxxxxxxx/
>
> drivers/md/raid0.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
Applied to md-7.3

--
Thanks,
Kuai