[dm-devel] md: fix missing check on list iterator

Xiaomeng Tong xiam0nd.tong at gmail.com
Sun Apr 3 03:56:03 UTC 2022


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



More information about the dm-devel mailing list