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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0incdNCxt=0AAdtbsBVdazZMCWG=15PUAnnpz8Rvr=psg@mail.gmail.com>
Date: Thu, 11 Sep 2025 14:49:09 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Pin-yen Lin <treapking@...omium.org>
Cc: Len Brown <lenb@...nel.org>, Pavel Machek <pavel@...nel.org>, 
	Danilo Krummrich <dakr@...nel.org>, Saravana Kannan <saravanak@...gle.com>, 
	Hsin-Te Yuan <yuanhsinte@...omium.org>, linux-pm@...r.kernel.org, 
	Chen-Yu Tsai <wenst@...omium.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] PM: sleep: Don't wait for SYNC_STATE_ONLY device links

On Thu, Sep 11, 2025 at 2:28 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Thu, Sep 11, 2025 at 07:16:03PM +0800, Pin-yen Lin wrote:
> > Device links with DL_FLAG_SYNC_STATE_ONLY should not affect suspend
> > and resume, and functions like device_reorder_to_tail() and
> > device_link_add() doesn't try to reorder the consumers with such flag.
> >
> > However, dpm_wait_for_consumers() and dpm_wait_for_suppliers() doesn't
> > check this flag before triggering dpm_wait, leading to potential hang
> > during suspend/resume.
> >
> > This can be reproduced on MT8186 Corsola Chromebook with devicetree like:
> >
> > usb-a-connector {
> >         compatible = "usb-a-connector";
> >         port {
> >                 usb_a_con: endpoint {
> >                         remote-endpoint = <&usb_hs>;
> >                 };
> >         };
> > };
> >
> > usb_host {
> >         compatible = "mediatek,mt8186-xhci", "mediatek,mtk-xhci";
> >         port {
> >                 usb_hs: endpoint {
> >                         remote-endpoint = <&usb_a_con>;
> >                 };
> >         };
> > };
> >
> > In this case, the two nodes form a cycle and a SYNC_STATE_ONLY devlink
> > between usb_host (supplier) and usb-a-connector (consumer) is created.
> >
> > Use device_link_flag_is_sync_state_only() to check this in
> > dpm_wait_for_consumers() and dpm_wait_for_suppliers() to fix this.
> >
> > Fixes: 05ef983e0d65a ("driver core: Add device link support for SYNC_STATE_ONLY flag")
> > Signed-off-by: Pin-yen Lin <treapking@...omium.org>
> > ---
> >
> > Changes in v2:
> > - Update commit message
> > - Use device_link_flag_is_sync_state_only()
> >
> >  drivers/base/power/main.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> > index 2ea6e05e6ec9..73a1916170ae 100644
> > --- a/drivers/base/power/main.c
> > +++ b/drivers/base/power/main.c
> > @@ -282,7 +282,8 @@ static void dpm_wait_for_suppliers(struct device *dev, bool async)
> >        * walking.
> >        */
> >       list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
> > -             if (READ_ONCE(link->status) != DL_STATE_DORMANT)
> > +             if (READ_ONCE(link->status) != DL_STATE_DORMANT &&
> > +                 !device_link_flag_is_sync_state_only(link->flags))
> >                       dpm_wait(link->supplier, async);
> >
> >       device_links_read_unlock(idx);
> > @@ -339,7 +340,8 @@ static void dpm_wait_for_consumers(struct device *dev, bool async)
> >        * unregistration).
> >        */
> >       list_for_each_entry_rcu_locked(link, &dev->links.consumers, s_node)
> > -             if (READ_ONCE(link->status) != DL_STATE_DORMANT)
> > +             if (READ_ONCE(link->status) != DL_STATE_DORMANT &&
> > +                 !device_link_flag_is_sync_state_only(link->flags))
> >                       dpm_wait(link->consumer, async);
> >
> >       device_links_read_unlock(idx);
>
> The way you use this new function does not require it to have been
> exported to modules :(

Also, I'd just make it non-static (without exporting it to modules)
and use it in the same patch because the new usage is the reason for
exporting.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ