[PATCH net-next v2] net: ethernet: mtk-star-emac: fix device_node leak in mtk_star_probe()

Bartosz Golaszewski brgl at kernel.org
Thu Nov 12 02:12:11 PST 2026


On Thu, Nov 12, 2026 at 11:51:30AM +0800, Xia Yan wrote:
> 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 <yanxia at cmss.chinamobile.com>
> ---

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski at oss.qualcomm.com> 



More information about the Linux-mediatek mailing list