On Mon, Feb 2, 2026 at 9:23 PM Samuel Wu <[email protected]> wrote:
>
> On Tue, Jan 27, 2026 at 8:15 AM Rafael J. Wysocki <[email protected]> wrote:
> >
> > On Sat, Jan 24, 2026 at 2:22 AM Samuel Wu <[email protected]> wrote:
> > >
> > > In the case of an empty wakeup_sources list, wakeup_sources_walk_start()
> > > will return an invalid but non-NULL address. This also affects wrappers
> > > of the aforementioned function, like for_each_wakeup_source().
> > >
> > > This patch updates wakeup_sources_walk_start() to return NULL in case of
> > > an empty list.
> > >
> > > Signed-off-by: Samuel Wu <[email protected]>
> > > ---
> > >  drivers/base/power/wakeup.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> > > index 1e1a0e7eeac5..e69033d16fba 100644
> > > --- a/drivers/base/power/wakeup.c
> > > +++ b/drivers/base/power/wakeup.c
> > > @@ -275,9 +275,7 @@ EXPORT_SYMBOL_GPL(wakeup_sources_read_unlock);
> > >   */
> > >  struct wakeup_source *wakeup_sources_walk_start(void)
> > >  {
> > > -       struct list_head *ws_head = &wakeup_sources;
> > > -
> > > -       return list_entry_rcu(ws_head->next, struct wakeup_source, entry);
> > > +       return list_first_or_null_rcu(&wakeup_sources, struct 
> > > wakeup_source, entry);
> > >  }
> > >  EXPORT_SYMBOL_GPL(wakeup_sources_walk_start);
> > >
> > > --
> >
> > This looks like a fix for the for_each_wakeup_source() users.
> >
> > I can apply it without the next two patches.
>
> Yes please. Feel free to apply this patch independently, as it can
> exist as a standalone fix independent of the subsequent two patches in
> the series.

OK, applied as 6.20/7.0 material, thanks!

Reply via email to