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: <06710fb3-fc55-479e-b029-134f41fb93eb@linux.dev>
Date: Tue, 8 Jul 2025 11:33:46 -0400
From: Sean Anderson <sean.anderson@...ux.dev>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
 netdev@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>,
 linux-kernel@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
 Florian Fainelli <f.fainelli@...il.com>, Jakub Kicinski <kuba@...nel.org>,
 Eric Dumazet <edumazet@...gle.com>, Christian Marangi <ansuelsmth@...il.com>
Subject: Re: [PATCH net] net: phy: Don't register LEDs for genphy

On 7/8/25 04:58, Russell King (Oracle) wrote:
> On Mon, Jul 07, 2025 at 03:58:03PM -0400, Sean Anderson wrote:
>> If a PHY has no driver, the genphy driver is probed/removed directly in
>> phy_attach/detach. If the PHY's ofnode has an "leds" subnode, then the
>> LEDs will be (un)registered when probing/removing the genphy driver.
> 
> Maybe checking whether the PHY driver supports LEDs would be more
> sensible than checking whether it's one of the genphy drivers?

The genphy driver is special, since it is probed synchronously from
phy_attach. All other drivers are probed asynchronously and don't have
this problem.

>> This could occur if the leds are for a non-generic driver that isn't
>> loaded for whatever reason. Synchronously removing the PHY device in
>> phy_detach leads to the following deadlock:
>> 
>> rtnl_lock()
>> ndo_close()
>>     ...
>>     phy_detach()
>>         phy_remove()
>>             phy_leds_unregister()
>>                 led_classdev_unregister()
>>                     led_trigger_set()
>>                         netdev_trigger_deactivate()
>>                             unregister_netdevice_notifier()
>>                                 rtnl_lock()
>> 
>> There is a corresponding deadlock on the open/register side of things
>> (and that one is reported by lockdep), but it requires a race while this
>> one is deterministic.
> 
> Doesn't this deadlock exist irrespective of whether the genphy driver(s)
> are being used, and whether or not the PHY driver supports LEDs?

Nope.

--Sean

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ