net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks
Subsystems (2)
PATCH 1/1 net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks
of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. am65_cpsw_init_cpts() and am65_cpsw_nuss_probe() don't release the refcount in error case.
Add missing of_node_put() to avoid refcount leak.
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +2 -1
@@ -1788,6 +1788,7 @@ static int am65_cpsw_init_cpts(struct am65_cpsw_common *common)if (IS_ERR (cpts)) {int ret =PTR_ERR (cpts); +of_node_put (node);if (ret == -EOPNOTSUPP ) {dev_info (dev,"cpts disabled\n" );return 0 ;
@@ -2662,9 +2663,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)if (!node)return -ENOENT ; common->port_num =of_get_child_count (node); +of_node_put (node);if (common->port_num <1 || common->port_num >AM65_CPSW_MAX_PORTS )return -ENOENT ; -of_node_put (node); common->rx_flow_id_base =-1 ;init_completion (&common->tdown_complete);
Signature · 1 line
2.25.1
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 11 lines · On Thu, 26 May 2022 12:52:08 +0400 you wrote:
of_get_child_by_name()returns a node pointer with refcount incremented, we should useof_node_put()on it when not need anymore.am65_cpsw_init_cpts()andam65_cpsw_nuss_probe()don't release the refcount in error case.
Add missingof_node_put()to avoid refcount leak.Fixes b1f66a5bee07 ("net: ethernet: ti: am65-cpsw-nuss: enable packet timestamping support")Fixes 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver")Signed-off-by Miaoqian Lin <[email protected]>[...]
Here is the summary with links:
- net: ethernet: ti: am65-cpsw-nuss: Fix some refcount leaks
https://git.kernel.org/netdev/net/c/5dd89d2fc438
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html