public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc()
  2026-05-04 20:03 [PATCH net] " Shitalkumar Gandhi
@ 2026-05-05  8:58 ` Shitalkumar Gandhi
  2026-05-05 12:25   ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Shitalkumar Gandhi @ 2026-05-05  8:58 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Geert Uytterhoeven, Jakub Kicinski, David S . Miller,
	Eric Dumazet, Paolo Abeni, Andrew Lunn, Simon Horman, netdev,
	linux-renesas-soc, linux-kernel, Shitalkumar Gandhi

of_get_child_by_name() takes a reference. The rtsn_reset() and
rtsn_change_mode() failure paths jump to out_free_bus and leak
mdio_node.

Add out_put_node to drop it before falling through.

Fixes: b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")
Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Changes in v2:
- Restore blank line between `return 0;` and `out_put_node:` label (Geert)
- Add Reviewed-by: Geert Uytterhoeven

Link to v1: https://lore.kernel.org/netdev/20260504200356.3529873-1-shitalkumar.gandhi@cambiumnetworks.com/

 drivers/net/ethernet/renesas/rtsn.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/rtsn.c b/drivers/net/ethernet/renesas/rtsn.c
index 03a2669f0518..ee8381b60b8d 100644
--- a/drivers/net/ethernet/renesas/rtsn.c
+++ b/drivers/net/ethernet/renesas/rtsn.c
@@ -797,11 +797,11 @@ static int rtsn_mdio_alloc(struct rtsn_private *priv)
 	/* Enter config mode before registering the MDIO bus */
 	ret = rtsn_reset(priv);
 	if (ret)
-		goto out_free_bus;
+		goto out_put_node;
 
 	ret = rtsn_change_mode(priv, OCR_OPC_CONFIG);
 	if (ret)
-		goto out_free_bus;
+		goto out_put_node;
 
 	rtsn_modify(priv, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
 		    MPIC_PSMCS_DEFAULT | MPIC_PSMHT_DEFAULT);
@@ -824,6 +824,8 @@ static int rtsn_mdio_alloc(struct rtsn_private *priv)
 
 	return 0;
 
+out_put_node:
+	of_node_put(mdio_node);
 out_free_bus:
 	mdiobus_free(mii);
 	return ret;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc()
  2026-05-05  8:58 ` [PATCH net v2] " Shitalkumar Gandhi
@ 2026-05-05 12:25   ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2026-05-05 12:25 UTC (permalink / raw)
  To: Shitalkumar Gandhi
  Cc: Niklas Söderlund, Geert Uytterhoeven, Jakub Kicinski,
	David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman, netdev,
	linux-renesas-soc, linux-kernel, Shitalkumar Gandhi

On Tue, May 05, 2026 at 02:28:40PM +0530, Shitalkumar Gandhi wrote:
> of_get_child_by_name() takes a reference. The rtsn_reset() and
> rtsn_change_mode() failure paths jump to out_free_bus and leak
> mdio_node.
> 
> Add out_put_node to drop it before falling through.
> 
> Fixes: b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")
> Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Changes in v2:
> - Restore blank line between `return 0;` and `out_put_node:` label (Geert)
> - Add Reviewed-by: Geert Uytterhoeven

Please always create a new thread for a new version of the
patch. Without that, the CI system just sees a comment to an existing
patch, and does not run. So this patch has not been through usual
testing, and will be ignored.

	Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc()
@ 2026-05-05 12:32 Shitalkumar Gandhi
  2026-05-05 12:35 ` Andrew Lunn
  2026-05-05 15:19 ` Niklas Söderlund
  0 siblings, 2 replies; 5+ messages in thread
From: Shitalkumar Gandhi @ 2026-05-05 12:32 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Geert Uytterhoeven, Andrew Lunn, Jakub Kicinski, David S . Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, netdev,
	linux-renesas-soc, linux-kernel, Shitalkumar Gandhi

of_get_child_by_name() takes a reference. The rtsn_reset() and
rtsn_change_mode() failure paths jump to out_free_bus and leak
mdio_node.

Add out_put_node to drop it before falling through.

Fixes: b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")
Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Changes in v2:
- Restore blank line between `return 0;` and `out_put_node:` label (Geert)
- Add Reviewed-by: Geert Uytterhoeven

Resent as a new thread (no code changes) so netdev CI picks it up
(Andrew).

Link to v1: https://lore.kernel.org/netdev/20260504200356.3529873-1-shitalkumar.gandhi@cambiumnetworks.com/
Link to v2 (mis-threaded): https://lore.kernel.org/netdev/20260505085840.352206-1-shitalkumar.gandhi@cambiumnetworks.com/

 drivers/net/ethernet/renesas/rtsn.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/rtsn.c b/drivers/net/ethernet/renesas/rtsn.c
index 03a2669f0518..ee8381b60b8d 100644
--- a/drivers/net/ethernet/renesas/rtsn.c
+++ b/drivers/net/ethernet/renesas/rtsn.c
@@ -797,11 +797,11 @@ static int rtsn_mdio_alloc(struct rtsn_private *priv)
 	/* Enter config mode before registering the MDIO bus */
 	ret = rtsn_reset(priv);
 	if (ret)
-		goto out_free_bus;
+		goto out_put_node;
 
 	ret = rtsn_change_mode(priv, OCR_OPC_CONFIG);
 	if (ret)
-		goto out_free_bus;
+		goto out_put_node;
 
 	rtsn_modify(priv, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
 		    MPIC_PSMCS_DEFAULT | MPIC_PSMHT_DEFAULT);
@@ -824,6 +824,8 @@ static int rtsn_mdio_alloc(struct rtsn_private *priv)
 
 	return 0;
 
+out_put_node:
+	of_node_put(mdio_node);
 out_free_bus:
 	mdiobus_free(mii);
 	return ret;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc()
  2026-05-05 12:32 [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc() Shitalkumar Gandhi
@ 2026-05-05 12:35 ` Andrew Lunn
  2026-05-05 15:19 ` Niklas Söderlund
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2026-05-05 12:35 UTC (permalink / raw)
  To: Shitalkumar Gandhi
  Cc: Niklas Söderlund, Geert Uytterhoeven, Jakub Kicinski,
	David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman, netdev,
	linux-renesas-soc, linux-kernel, Shitalkumar Gandhi

On Tue, May 05, 2026 at 06:02:36PM +0530, Shitalkumar Gandhi wrote:
> of_get_child_by_name() takes a reference. The rtsn_reset() and
> rtsn_change_mode() failure paths jump to out_free_bus and leak
> mdio_node.
> 
> Add out_put_node to drop it before falling through.
> 
> Fixes: b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")
> Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc()
  2026-05-05 12:32 [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc() Shitalkumar Gandhi
  2026-05-05 12:35 ` Andrew Lunn
@ 2026-05-05 15:19 ` Niklas Söderlund
  1 sibling, 0 replies; 5+ messages in thread
From: Niklas Söderlund @ 2026-05-05 15:19 UTC (permalink / raw)
  To: Shitalkumar Gandhi
  Cc: Geert Uytterhoeven, Andrew Lunn, Jakub Kicinski, David S . Miller,
	Eric Dumazet, Paolo Abeni, Simon Horman, netdev,
	linux-renesas-soc, linux-kernel, Shitalkumar Gandhi

Hi Shitalkumar,

Thanks for your work.

On 2026-05-05 18:02:36 +0530, Shitalkumar Gandhi wrote:
> of_get_child_by_name() takes a reference. The rtsn_reset() and
> rtsn_change_mode() failure paths jump to out_free_bus and leak
> mdio_node.
> 
> Add out_put_node to drop it before falling through.
> 
> Fixes: b0d3969d2b4d ("net: ethernet: rtsn: Add support for Renesas Ethernet-TSN")
> Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> Changes in v2:
> - Restore blank line between `return 0;` and `out_put_node:` label (Geert)
> - Add Reviewed-by: Geert Uytterhoeven
> 
> Resent as a new thread (no code changes) so netdev CI picks it up
> (Andrew).
> 
> Link to v1: https://lore.kernel.org/netdev/20260504200356.3529873-1-shitalkumar.gandhi@cambiumnetworks.com/
> Link to v2 (mis-threaded): https://lore.kernel.org/netdev/20260505085840.352206-1-shitalkumar.gandhi@cambiumnetworks.com/
> 
>  drivers/net/ethernet/renesas/rtsn.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/rtsn.c b/drivers/net/ethernet/renesas/rtsn.c
> index 03a2669f0518..ee8381b60b8d 100644
> --- a/drivers/net/ethernet/renesas/rtsn.c
> +++ b/drivers/net/ethernet/renesas/rtsn.c
> @@ -797,11 +797,11 @@ static int rtsn_mdio_alloc(struct rtsn_private *priv)
>  	/* Enter config mode before registering the MDIO bus */
>  	ret = rtsn_reset(priv);
>  	if (ret)
> -		goto out_free_bus;
> +		goto out_put_node;
>  
>  	ret = rtsn_change_mode(priv, OCR_OPC_CONFIG);
>  	if (ret)
> -		goto out_free_bus;
> +		goto out_put_node;
>  
>  	rtsn_modify(priv, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
>  		    MPIC_PSMCS_DEFAULT | MPIC_PSMHT_DEFAULT);
> @@ -824,6 +824,8 @@ static int rtsn_mdio_alloc(struct rtsn_private *priv)
>  
>  	return 0;
>  
> +out_put_node:
> +	of_node_put(mdio_node);
>  out_free_bus:
>  	mdiobus_free(mii);
>  	return ret;
> -- 
> 2.25.1
> 

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-05 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 12:32 [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc() Shitalkumar Gandhi
2026-05-05 12:35 ` Andrew Lunn
2026-05-05 15:19 ` Niklas Söderlund
  -- strict thread matches above, loose matches on Subject: below --
2026-05-04 20:03 [PATCH net] " Shitalkumar Gandhi
2026-05-05  8:58 ` [PATCH net v2] " Shitalkumar Gandhi
2026-05-05 12:25   ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox