lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jWCdEVgQxOAkek4qqVHMx3Xx4_W3ov9bvdJP=0acX=Yw@mail.gmail.com>
Date: Tue, 27 Jan 2026 17:15:22 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Samuel Wu <wusamuel@...gle.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>, Pavel Machek <pavel@...nel.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Danilo Krummrich <dakr@...nel.org>, 
	Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, 
	Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>, 
	KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, 
	Jiri Olsa <jolsa@...nel.org>, Shuah Khan <shuah@...nel.org>, kernel-team@...roid.com, 
	linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org, bpf@...r.kernel.org, 
	linux-kselftest@...r.kernel.org
Subject: Re: [PATCH bpf-next v3 1/3] PM: wakeup: Handle empty list in wakeup_sources_walk

On Sat, Jan 24, 2026 at 2:22 AM Samuel Wu <wusamuel@...gle.com> 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 <wusamuel@...gle.com>
> ---
>  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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ