Skip to contentSkip to conversation

ethtool: Fix refcount leak in gfar_get_ts_info

PATCH Applied Miaoqian Lin 5 participants 7 messages Mar 9, 2022 – Mar 10, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethtool: Fix refcount leak in gfar_get_ts_info

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Fixes 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata")
---
 drivers/net/ethernet/freescale/gianfar_ethtool.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/freescale/gianfar_ethtool.c +1 -0
index ff756265d58f..9a2c16d69e2c 100644
@@ -1464,6 +1464,7 @@ static int gfar_get_ts_info(struct net_device *dev,
 	ptp_node = of_find_compatible_node(NULL, NULL, "fsl,etsec-ptp");
 	if (ptp_node) {
 		ptp_dev = of_find_device_by_node(ptp_node);
+		of_node_put(ptp_node);
 		if (ptp_dev)
 			ptp = platform_get_drvdata(ptp_dev);
 	}
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line

Subject: [PATCH] ethtool: Fix refcount leak in gfar_get_ts_info

should be:
[PATCH net v2] gianfar: ethtool: Fix refcount leak in gfar_get_ts_info

Quoted 15 lines · Miaoqian Lin

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Fixes 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata")
---
  drivers/net/ethernet/freescale/gianfar_ethtool.c | 1 +
  1 file changed, 1 insertion(+)
drivers/net/ethernet/freescale/gianfar_ethtool.c +0 -0
index ff756265d58f..9a2c16d69e2c 100644

drivers/net/ethernet/freescale/gianfar_ethtool.c static int gfar_get_ts_info(struct net_device *dev, · line 1470

Quoted 7 lines
drivers/net/ethernet/freescale/gianfar_ethtool.c +1 -0
@@ -1464,6 +1464,7 @@ static int gfar_get_ts_info(struct net_device *dev,
  	ptp_node = of_find_compatible_node(NULL, NULL, "fsl,etsec-ptp");
  	if (ptp_node) {
  		ptp_dev = of_find_device_by_node(ptp_node);
+		of_node_put(ptp_node);
  		if (ptp_dev)
  			ptp = platform_get_drvdata(ptp_dev);
  	}

If you fix the subject and resend a v2, you can add

#2 lore raw

PATCH v2 1/1 gianfar: ethtool: Fix refcount leak in gfar_get_ts_info

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Fixes 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata")

---
changes in v2:
- Fix the subject

---
 drivers/net/ethernet/freescale/gianfar_ethtool.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/freescale/gianfar_ethtool.c +1 -0
index ff756265d58f..9a2c16d69e2c 100644
@@ -1464,6 +1464,7 @@ static int gfar_get_ts_info(struct net_device *dev,
 	ptp_node = of_find_compatible_node(NULL, NULL, "fsl,etsec-ptp");
 	if (ptp_node) {
 		ptp_dev = of_find_device_by_node(ptp_node);
+		of_node_put(ptp_node);
 		if (ptp_dev)
 			ptp = platform_get_drvdata(ptp_dev);
 	}
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 1/1
#3 lore raw

RE: [PATCH net v2] gianfar: ethtool: Fix refcount leak in gfar_get_ts_info

Quoted 14 lines

-----Original Message-----
From: Miaoqian Lin <[email protected]>
Sent: Thursday, March 10, 2022 3:53 AM
To: Claudiu Manoil <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Y.B. Lu <[email protected]>; [email protected]; linux- [email protected]
Cc: [email protected]
Subject: [PATCH net v2] gianfar: ethtool: Fix refcount leak in gfar_get_ts_info

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Quoted 8 lines
Fixes 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through

drvdata")

---
changes in v2:
- Fix the subject
---

#4 lore raw

Re: [PATCH net v2] gianfar: ethtool: Fix refcount leak in gfar_get_ts_info

In reply to Miaoqian Lin
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 10 Mar 2022 01:53:13 +0000 you wrote:

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Fixes 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata")

[...]

Here is the summary with links:
- [net,v2] gianfar: ethtool: Fix refcount leak in gfar_get_ts_info

    https://git.kernel.org/netdev/net/c/2ac5b58e645c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#5 lore raw
In reply to Miaoqian Lin
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 9 Mar 2022 09:11:49 +0000 you wrote:

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Fixes 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata")

[...]

Here is the summary with links:
- ethtool: Fix refcount leak in gfar_get_ts_info

    https://git.kernel.org/netdev/net/c/2ac5b58e645c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer
#6 lore raw
Quoted 4 lines · On Thu, 10 Mar 2022 20:30:10 +0000 [email protected] wrote:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

No, it wasn't. Maybe I forgot to mark this version as Changes Requested before applying v2.

Quoted 15 lines · On Wed, 9 Mar 2022 09:11:49 +0000 you wrote:
Quoted 8 lines

The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.

Fixes 7349a74ea75c ("net: ethernet: gianfar_ethtool: get phc index through drvdata")

[...]

Here is the summary with links:
- ethtool: Fix refcount leak in gfar_get_ts_info

    https://git.kernel.org/netdev/net/c/2ac5b58e645c

You are awesome, thank you!