[PATCH net-next v2] net: ethernet: mtk-star-emac: fix device_node leak in mtk_star_probe()
Lorenzo Bianconi
lorenzo at kernel.org
Thu Nov 12 03:04:25 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>
Reviewed-by: Lorenzo Bianconi <lorenzo at kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20261112/463cc0a2/attachment.sig>
More information about the Linux-mediatek
mailing list