public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Shitalkumar Gandhi <shital.gandhi45@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
Subject: Re: [PATCH net v2] net: rtsn: fix mdio_node leak in rtsn_mdio_alloc()
Date: Tue, 5 May 2026 17:19:39 +0200	[thread overview]
Message-ID: <20260505151939.GE683841@ragnatech.se> (raw)
In-Reply-To: <20260505123236.406000-1-shitalkumar.gandhi@cambiumnetworks.com>

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

  parent reply	other threads:[~2026-05-05 15:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- 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

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=20260505151939.GE683841@ragnatech.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shital.gandhi45@gmail.com \
    --cc=shitalkumar.gandhi@cambiumnetworks.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