Re: md: fix missing check on list iterator
From: Xiaomeng Tong
Date: Sat Apr 02 2022 - 23:56:33 EST
On Fri, 1 Apr 2022 10:47:18 -0400, Mike Snitzer wrote:
> Did you acually hit a bug (invalid memory access)?
>
> I cannot see how given the checks prior to iterating m->priority_groups:
>
> if (!pgstr || (sscanf(pgstr, "%u%c", &pgnum, &dummy) != 1) || !pgnum ||
> !m->nr_priority_groups || (pgnum > m->nr_priority_groups)) {
> DMWARN("invalid PG number supplied to bypass_pg");
> return -EINVAL;
> }
>
> So I have _not_ taken your "fix".
Yes, you are correct. It has been checked before, thus not a bug and
no need to fix. And I have sent a PATCH v2 to use list iterator only
inside the loop, please check it. Thank you very much.
--
Xiaomeng Tong