From: Florian Fainelli <florian.fainelli@broadcom.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
Doug Berger <opendmb@gmail.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Zak Kemble <zakkemble@gmail.com>, Simon Horman <horms@kernel.org>,
Ryo Takakura <ryotkkr98@gmail.com>,
linux-kernel@vger.kernel.org (open list),
Nicolai Buchwitz <nb@tipi-net.de>
Subject: [PATCH net 4/6] net: bcmasp: fix OF node reference leak for phy_dn
Date: Tue, 22 Sep 2026 15:16:28 -0700 [thread overview]
Message-ID: <20260922221630.3864427-5-florian.fainelli@broadcom.com> (raw)
In-Reply-To: <20260922221630.3864427-1-florian.fainelli@broadcom.com>
In bcmasp_interface_create(), intf->phy_dn is obtained via
of_parse_phandle() or assigned ndev_dn. of_parse_phandle() returns a
node reference with its refcount incremented, but of_node_put() was
never called on intf->phy_dn in bcmasp_interface_destroy() or the
error unwind path in bcmasp_interface_create().
Acquire a reference on ndev_dn for the fixed-link case as well so that
intf->phy_dn consistently holds a reference, and release it with
of_node_put() on teardown and error.
Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
Assisted-by: LLM
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index 2ad8a7eac888..7a63a592f158 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -1298,7 +1298,7 @@ struct bcmasp_intf *bcmasp_interface_create(struct bcmasp_priv *priv,
ndev_dn->name);
goto err_free_netdev;
}
- intf->phy_dn = ndev_dn;
+ intf->phy_dn = of_node_get(ndev_dn);
}
/* Map resource */
@@ -1338,6 +1338,7 @@ struct bcmasp_intf *bcmasp_interface_create(struct bcmasp_priv *priv,
err_deregister_fixed_link:
if (of_phy_is_fixed_link(ndev_dn))
of_phy_deregister_fixed_link(ndev_dn);
+ of_node_put(intf->phy_dn);
err_free_netdev:
free_netdev(ndev);
err:
@@ -1350,6 +1351,7 @@ void bcmasp_interface_destroy(struct bcmasp_intf *intf)
unregister_netdev(intf->ndev);
if (of_phy_is_fixed_link(intf->ndev_dn))
of_phy_deregister_fixed_link(intf->ndev_dn);
+ of_node_put(intf->phy_dn);
free_netdev(intf->ndev);
}
--
2.34.1
next prev parent reply other threads:[~2026-09-22 22:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 22:16 [PATCH net 0/6] net: bcmasp: Collection of fixes Florian Fainelli
2026-09-22 22:16 ` [PATCH net 1/6] net: bcmasp: fix mib counters struct alignment with ethtool stats Florian Fainelli
2026-09-22 22:16 ` [PATCH net 2/6] net: bcmasp: unmap previous DMA mappings on TX map failure Florian Fainelli
2026-09-22 22:16 ` [PATCH net 3/6] net: bcmasp: validate minimum RX packet size in bcmasp_rx_poll() Florian Fainelli
2026-09-22 22:16 ` Florian Fainelli [this message]
2026-09-22 22:16 ` [PATCH net 5/6] net: bcmasp: account for offload header in TX short packet padding Florian Fainelli
2026-09-22 22:16 ` [PATCH net 6/6] net: bcmasp: fix network filter lookup and wake filter pair allocation Florian Fainelli
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=20260922221630.3864427-5-florian.fainelli@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=ryotkkr98@gmail.com \
--cc=zakkemble@gmail.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®