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 1/2] net: pse-pd: tps23881: Fix device node refcount leakage in tps23881_get_of_channels()
Date: Thu, 12 Dec 2024 23:06:54 +0800 [thread overview]
Message-ID: <20241212-drivers_fix-v1-1-a3fbb0bf6846@quicinc.com> (raw)
In-Reply-To: <20241212-drivers_fix-v1-0-a3fbb0bf6846@quicinc.com>
From: Zijun Hu <quic_zijuhu@quicinc.com>
tps23881_get_of_channels() invokes of_find_node_by_name(@priv->np, ...)
and the callee will put OF device node @priv->np refcount, but the caller
does not compensate the refcount before the invocation, so causes the node
refcount leakage.
Fix by of_node_get(@priv->np) before the invocation.
Fixes: 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
drivers/net/pse-pd/tps23881.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index 5c4e88be46ee3316330e26a68d06540ff1db86ff..f5c04dd5be379f7b9697e067a32d59028f446088 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -216,6 +216,7 @@ tps23881_get_of_channels(struct tps23881_priv *priv,
if (!priv->np)
return -EINVAL;
+ of_node_get(priv->np);
channels_node = of_find_node_by_name(priv->np, "channels");
if (!channels_node)
return -EINVAL;
--
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 ` Zijun Hu [this message]
2024-12-12 15:06 ` [PATCH net 2/2] net: bcmasp: Fix device node refcount leakage in bcmasp_probe() Zijun Hu
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-1-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®