From: Zijun Hu <zijun_hu@icloud.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
Kory Maincent <kory.maincent@bootlin.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>,
Justin Chen <justin.chen@broadcom.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Simon Horman <horms@kernel.org>
Cc: Zijun Hu <zijun_hu@icloud.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
Zijun Hu <quic_zijuhu@quicinc.com>
Subject: [PATCH net 2/2] net: bcmasp: Fix device node refcount leakage in bcmasp_probe()
Date: Thu, 12 Dec 2024 23:06:55 +0800 [thread overview]
Message-ID: <20241212-drivers_fix-v1-2-a3fbb0bf6846@quicinc.com> (raw)
In-Reply-To: <20241212-drivers_fix-v1-0-a3fbb0bf6846@quicinc.com>
From: Zijun Hu <quic_zijuhu@quicinc.com>
bcmasp_probe() invokes of_find_node_by_name(@dev->of_node, ...) and the
callee will put OF device node @dev->of_node refcount, but the caller
does not compensate the refcount before the invocation, so causes the node
refcount leakage.
Fix by of_node_get(@dev->of_node) before the invocation.
Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/net/ethernet/broadcom/asp2/bcmasp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index 297c2682a9cf979fbc4af211139f1b1ed0df01d5..517593c5894568111111aff0f6919fb02d780c85 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -1367,6 +1367,7 @@ static int bcmasp_probe(struct platform_device *pdev)
bcmasp_core_init(priv);
bcmasp_core_init_filters(priv);
+ of_node_get(dev->of_node);
ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports");
if (!ports_node) {
dev_warn(dev, "No ports found\n");
--
2.34.1
next prev parent reply other threads:[~2024-12-12 15:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 15:06 [PATCH net 0/2] net: Fix 2 OF device node refcount leakage issues Zijun Hu
2024-12-12 15:06 ` [PATCH net 1/2] net: pse-pd: tps23881: Fix device node refcount leakage in tps23881_get_of_channels() Zijun Hu
2024-12-12 15:06 ` Zijun Hu [this message]
2024-12-12 15:33 ` [PATCH net 0/2] net: Fix 2 OF device node refcount leakage issues Kory Maincent
2024-12-13 10:50 ` Zijun Hu
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=20241212-drivers_fix-v1-2-a3fbb0bf6846@quicinc.com \
--to=zijun_hu@icloud.com \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=horms@kernel.org \
--cc=justin.chen@broadcom.com \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=quic_zijuhu@quicinc.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®