[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241212-drivers_fix-v1-1-a3fbb0bf6846@quicinc.com>
Date: Thu, 12 Dec 2024 23:06:54 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Oleksij Rempel <o.rempel@...gutronix.de>,
Kory Maincent <kory.maincent@...tlin.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Justin Chen <justin.chen@...adcom.com>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Simon Horman <horms@...nel.org>
Cc: Zijun Hu <zijun_hu@...oud.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, bcm-kernel-feedback-list@...adcom.com,
Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH net 1/2] net: pse-pd: tps23881: Fix device node refcount
leakage in tps23881_get_of_channels()
From: Zijun Hu <quic_zijuhu@...cinc.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@...cinc.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
Powered by blists - more mailing lists