Re: [PATCH v2] md: fix an incorrect NULL check in sync_sbs

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

 



On Thu, 7 Apr 2022 17:36:48 -0700, Song Liu wrote:
> On Mon, Mar 28, 2022 at 1:11 AM Xiaomeng Tong <xiam0nd.tong@xxxxxxxxx> 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 'pdev' as a dedicated pointer to
> 
> s/pdev/rdev/
>
Have fixed it in PATCH v3, please check it. Thank you.

> 
> > point to the found element.
> >
> > Cc: stable@xxxxxxxxxxxxxxx
> > Fixes: 2aa82191ac36c ("md-cluster: Perform a lazy update")
> 
> "Fixes" should use a hash of 12 characters (13 given here). Did
> checkpatch.pl complain about it?

Have fixed it in PATCH v3, please check it. Thank you.

--
Xiaomeng Tong



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux