Thread (2 messages) 2 messages, 2 authors, 19d ago

Re: [PATCH] fix: net: mdio: of_phy_register_fixed_link: fix phy_device reference leak via discarded pointer

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-06-26 16:11:44
Also in: lkml, stable

On Fri, Jun 26, 2026 at 11:33:30PM +0800, WenTao Liang wrote:
fixed_phy_register returns a struct phy_device pointer with a held
  reference on success. However, the register_phy label discards the
  pointer via PTR_ERR_OR_ZERO, and the phy_device's fwnode is not set, so
  of_phy_deregister_fixed_link cannot find the device via
  bus_find_device_by_fwnode to clean it up. This permanently leaks the
  phy_device and its device_node reference.

Store the returned phy_device pointer and set dev->fwnode so the
  deregister path can properly locate and clean it up.

Cc: stable@vger.kernel.org
Fixes: 24c30dbbcdda ("of/mdio: Add support function for Ethernet fixed-link property")
Signed-off-by: WenTao Liang <redacted>

    Andrew

---
pw-bot: cr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help