Skip to contentSkip to conversation

net: ethtool: cable-test: Release RTNL when the PHY isn't found

PATCH Applied Maxime Chevallier 4 participants 4 messages Aug 27, 2024 – Aug 29, 2024

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

PATCH 1/1 net: ethtool: cable-test: Release RTNL when the PHY isn't found

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")

---

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(-)
net/ethtool/cabletest.c +2 -2
index ff2fe3566ace..371bdc1598ce 100644
@@ -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;
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Maxime Chevallier

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")

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

Quoted 27 lines

---

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(-)
net/ethtool/cabletest.c +2 -2
index ff2fe3566ace..371bdc1598ce 100644
@@ -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;
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#2 lore raw
In reply to Maxime Chevallier
Quoted 8 lines · Maxime Chevallier

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")
Signature · 1 line
Florian
#3 lore raw
In reply to Maxime Chevallier
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 10 lines · 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")

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html