]> git.dujemihanovic.xyz Git - linux.git/commit
net: phy: Manual remove LEDs to ensure correct ordering
authorAndrew Lunn <andrew@lunn.ch>
Sat, 17 Jun 2023 15:55:00 +0000 (17:55 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Jun 2023 16:33:05 +0000 (17:33 +0100)
commitc938ab4da0eb1620ae3243b0b24c572ddfc318fc
treea6982b5b06fb0a12a1a7e1a71c937004aac974d8
parenteb09fc2d14163c0c217846cfabec3d0cce7c8f8c
net: phy: Manual remove LEDs to ensure correct ordering

If the core is left to remove the LEDs via devm_, it is performed too
late, after the PHY driver is removed from the PHY. This results in
dereferencing a NULL pointer when the LED core tries to turn the LED
off before destroying the LED.

Manually unregister the LEDs at a safe point in phy_remove.

Cc: stable@vger.kernel.org
Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Fixes: 01e5b728e9e4 ("net: phy: Add a binding for PHY LEDs")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c