netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found
@ 2024-08-27  9:23 Maxime Chevallier
  2024-08-27 10:45 ` Larysa Zaremba
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maxime Chevallier @ 2024-08-27  9:23 UTC (permalink / raw)
  To: davem
  Cc: Maxime Chevallier, netdev, linux-kernel, thomas.petazzoni,
	Andrew Lunn, Jakub Kicinski, Eric Dumazet, Paolo Abeni,
	Russell King, linux-arm-kernel, Christophe Leroy, Herve Codina,
	Florian Fainelli, Heiner Kallweit, Vladimir Oltean,
	Köry Maincent, Marek Behún, Oleksij Rempel,
	Simon Horman, mwojtas, Dan Carpenter, Romain Gantois

Use the correct logic to check for the presence of a PHY device, and
jump to a label that correctly releases RTNL in case of an error, as we
are holding RTNL at that point.

Fixes: 3688ff3077d3 ("net: ethtool: cable-test: Target the command to the requested PHY")
Closes: https://lore.kernel.org/netdev/20240827104825.5cbe0602@fedora-3.home/T/#m6bc49cdcc5cfab0d162516b92916b944a01c833f
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
---

I'm targetting this patch to net-next as this is where the commit it fixes lives.

 net/ethtool/cabletest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c
index ff2fe3566ace..371bdc1598ce 100644
--- a/net/ethtool/cabletest.c
+++ b/net/ethtool/cabletest.c
@@ -343,9 +343,9 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
 	phydev = ethnl_req_get_phydev(&req_info,
 				      tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER],
 				      info->extack);
-	if (!IS_ERR_OR_NULL(phydev)) {
+	if (IS_ERR_OR_NULL(phydev)) {
 		ret = -EOPNOTSUPP;
-		goto out_dev_put;
+		goto out_rtnl;
 	}
 
 	ops = ethtool_phy_ops;
-- 
2.45.2


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

* Re: [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found
  2024-08-27  9:23 [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found Maxime Chevallier
@ 2024-08-27 10:45 ` Larysa Zaremba
  2024-08-27 18:16 ` Florian Fainelli
  2024-08-29  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Larysa Zaremba @ 2024-08-27 10:45 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: davem, netdev, linux-kernel, thomas.petazzoni, Andrew Lunn,
	Jakub Kicinski, Eric Dumazet, Paolo Abeni, Russell King,
	linux-arm-kernel, Christophe Leroy, Herve Codina,
	Florian Fainelli, Heiner Kallweit, Vladimir Oltean,
	Köry Maincent, Marek Behún, Oleksij Rempel,
	Simon Horman, mwojtas, Dan Carpenter, Romain Gantois

On Tue, Aug 27, 2024 at 11:23:13AM +0200, Maxime Chevallier wrote:
> Use the correct logic to check for the presence of a PHY device, and
> jump to a label that correctly releases RTNL in case of an error, as we
> are holding RTNL at that point.
> 
> Fixes: 3688ff3077d3 ("net: ethtool: cable-test: Target the command to the requested PHY")
> Closes: https://lore.kernel.org/netdev/20240827104825.5cbe0602@fedora-3.home/T/#m6bc49cdcc5cfab0d162516b92916b944a01c833f
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>

Your SoB has to be at the very end. The patch itself looks correct.

Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>

> ---
> 
> I'm targetting this patch to net-next as this is where the commit it fixes lives.
> 
>  net/ethtool/cabletest.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c
> index ff2fe3566ace..371bdc1598ce 100644
> --- a/net/ethtool/cabletest.c
> +++ b/net/ethtool/cabletest.c
> @@ -343,9 +343,9 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
>  	phydev = ethnl_req_get_phydev(&req_info,
>  				      tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER],
>  				      info->extack);
> -	if (!IS_ERR_OR_NULL(phydev)) {
> +	if (IS_ERR_OR_NULL(phydev)) {
>  		ret = -EOPNOTSUPP;
> -		goto out_dev_put;
> +		goto out_rtnl;
>  	}
>  
>  	ops = ethtool_phy_ops;
> -- 
> 2.45.2
> 
> 

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

* Re: [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found
  2024-08-27  9:23 [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found Maxime Chevallier
  2024-08-27 10:45 ` Larysa Zaremba
@ 2024-08-27 18:16 ` Florian Fainelli
  2024-08-29  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2024-08-27 18:16 UTC (permalink / raw)
  To: Maxime Chevallier, davem
  Cc: netdev, linux-kernel, thomas.petazzoni, Andrew Lunn,
	Jakub Kicinski, Eric Dumazet, Paolo Abeni, Russell King,
	linux-arm-kernel, Christophe Leroy, Herve Codina, Heiner Kallweit,
	Vladimir Oltean, Köry Maincent, Marek Behún,
	Oleksij Rempel, Simon Horman, mwojtas, Dan Carpenter,
	Romain Gantois

On 8/27/24 02:23, Maxime Chevallier wrote:
> Use the correct logic to check for the presence of a PHY device, and
> jump to a label that correctly releases RTNL in case of an error, as we
> are holding RTNL at that point.
> 
> Fixes: 3688ff3077d3 ("net: ethtool: cable-test: Target the command to the requested PHY")
> Closes: https://lore.kernel.org/netdev/20240827104825.5cbe0602@fedora-3.home/T/#m6bc49cdcc5cfab0d162516b92916b944a01c833f
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


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

* Re: [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found
  2024-08-27  9:23 [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found Maxime Chevallier
  2024-08-27 10:45 ` Larysa Zaremba
  2024-08-27 18:16 ` Florian Fainelli
@ 2024-08-29  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-29  1:00 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: davem, netdev, linux-kernel, thomas.petazzoni, andrew, kuba,
	edumazet, pabeni, linux, linux-arm-kernel, christophe.leroy,
	herve.codina, f.fainelli, hkallweit1, vladimir.oltean,
	kory.maincent, kabel, o.rempel, horms, mwojtas, dan.carpenter,
	romain.gantois

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 27 Aug 2024 11:23:13 +0200 you wrote:
> Use the correct logic to check for the presence of a PHY device, and
> jump to a label that correctly releases RTNL in case of an error, as we
> are holding RTNL at that point.
> 
> Fixes: 3688ff3077d3 ("net: ethtool: cable-test: Target the command to the requested PHY")
> Closes: https://lore.kernel.org/netdev/20240827104825.5cbe0602@fedora-3.home/T/#m6bc49cdcc5cfab0d162516b92916b944a01c833f
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> [...]

Here is the summary with links:
  - [net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found
    https://git.kernel.org/netdev/net-next/c/ad78337cb20c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-08-29  1:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27  9:23 [PATCH net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found Maxime Chevallier
2024-08-27 10:45 ` Larysa Zaremba
2024-08-27 18:16 ` Florian Fainelli
2024-08-29  1:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).