Re: [PATCH v3] md: fix an incorrect NULL check in does_sb_need_changing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 8, 2022 at 5:23 AM Goldwyn Rodrigues <rgoldwyn@xxxxxxx> wrote:
>
> On 16:37 08/04, Xiaomeng Tong wrote:
> > The bug is here:
> >       if (!rdev)
> >
> > The list iterator value 'rdev' will *always* be set and non-NULL
> > by rdev_for_each(), so it is incorrect to assume that the iterator
> > value will be NULL if the list is empty or no element found.
> > Otherwise it will bypass the NULL check and lead to invalid memory
> > access passing the check.
> >
> > To fix the bug, use a new variable 'iter' as the list iterator,
> > while using the original variable 'rdev' as a dedicated pointer to
> > point to the found element.
> >
> > Cc: stable@xxxxxxxxxxxxxxx
> > Fixes: 2aa82191ac36 ("md-cluster: Perform a lazy update")
> > Acked-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxx>
> > Signed-off-by: Xiaomeng Tong <xiam0nd.tong@xxxxxxxxx>
>
> Also safeguards from reading sb from a faulty device if all devices are
> faulty.
>
> Acked-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>

Applied to md-next. Thanks!



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux