Re: [PATCH] md/raid10: fix divide-by-zero in setup_geo() with zero far_copies

From: Yu Kuai

Date: Wed May 20 2026 - 07:57:45 EST


Hi,

在 2026/4/28 16:37, Yuhao Jiang 写道:
> Hi Kuai,
>
> Looks like different maintainers have different rules. :(
> Can you send me the patchwork resource?

Usually just a link to lore url is enough.

>
> Thanks.
>
> On Tue, Apr 28, 2026 at 4:32 PM Yu Kuai <yukuai@xxxxxxxxx> wrote:
>> Hi,
>>
>> 在 2026/4/19 13:59, Yuhao Jiang 写道:
>>> Hi Kuai,
>>>
>>> This report was reported by me, so Junrui added me as Reported-by.
>> This is fine, however, please do not add downstream reported-by tag.
>> If you want to add the reported-by tag, please report the problem to
>> patchwork first. :)
>>
>>> Thanks,
>>>
>>> On Sun, Apr 19, 2026 at 12:43 AM Yu Kuai <yukuai@xxxxxxxxx> wrote:
>>>
>>> Hi,
>>>
>>> 在 2026/4/16 11:39, Junrui Luo 写道:
>>> > setup_geo() extracts near_copies (nc) and far_copies (fc) from the
>>> > user-provided layout parameter without checking for zero. When fc=0
>>> > with the "improved" far set layout selected, 'geo->far_set_size =
>>> > disks / fc' triggers a divide-by-zero.
>>> >
>>> > Validate nc and fc immediately after extraction, returning -1 if
>>> > either is zero.
>>> >
>>> > Fixes: 475901aff158 ("MD RAID10: Improve redundancy for 'far'
>>> and 'offset' algorithms (part 1)")
>>> > Reported-by: Yuhao Jiang<danisjiang@xxxxxxxxx>
>>>
>>> So again I can't find a report, and Reported-by usually should be
>>> followed
>>> by a Closes link to the original report.
>>>
>>> Applied with Reported-by tag removed.
>>>
>>> > Cc:stable@xxxxxxxxxxxxxxx <mailto:Cc%3Astable@xxxxxxxxxxxxxxx>
>>> > Signed-off-by: Junrui Luo<moonafterrain@xxxxxxxxxxx>
>>> > ---
>>> > drivers/md/raid10.c | 2 ++
>>> > 1 file changed, 2 insertions(+)
>>>
>>> --
>>> Thansk,
>>> Kuai
>>>
>>>
>>>
>>> --
>>> Yuhao Jiang
>> --
>> Thansk,
>> Kuai
>
>
--
Thansk,
Kuai