On Thu, Nov 12, 2026 at 11:51:30AM +0800, Xia Yan wrote:
quoted
mtk_star_probe() gets the PHY node from the "phy-handle" property
with of_parse_phandle(). The helper takes a reference on the node it
returns. The node is used by of_phy_connect() each time the netdevice
is opened.
That reference is never dropped. Every error return after the lookup
leaks it. Unbind leaks it as well: the driver is devm-only and has no
remove callback.
Release it with a devm action, registered right after the lookup.
The error paths and the unbind path then drop the node through the
devm cleanup.
Found during a code review of the OF node handling in ethernet drivers.
Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
Signed-off-by: Xia Yan <redacted>
---
Reviewed-by: Bartosz Golaszewski <redacted>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>