From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Xia Yan <yanxia@cmss.chinamobile.com>,
netdev@vger.kernel.org, Felix Fietkau <nbd@nbd.name>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Yanqing Wang <ot_yanqing.wang@mediatek.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, yana06070@163.com
Subject: Re: [PATCH net-next v2] net: ethernet: mtk-star-emac: fix device_node leak in mtk_star_probe()
Date: Thu, 12 Nov 2026 12:04:25 +0100 [thread overview]
Message-ID: <avWdOWzBtEynoi7t@lore-desk> (raw)
In-Reply-To: <u6jz3rgrlwhlbhqwgi26lsa2knkwgjws6scbb6e3dq6bkjmudi@hiulukf72wrr>
[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]
> 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@cmss.chinamobile.com>
> > ---
>
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2026-11-12 11:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 3:51 Xia Yan
2026-11-12 4:13 ` netdev-bot+sinfo
2026-11-12 8:39 ` Xia Yan
2026-11-12 10:12 ` Bartosz Golaszewski
2026-11-12 11:04 ` Lorenzo Bianconi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avWdOWzBtEynoi7t@lore-desk \
--to=lorenzo@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=brgl@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=ot_yanqing.wang@mediatek.com \
--cc=pabeni@redhat.com \
--cc=yana06070@163.com \
--cc=yanxia@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®