diff mbox series

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

Message ID 20240827092314.2500284-1-maxime.chevallier@bootlin.com (mailing list archive)
State Accepted
Commit ad78337cb20c1a52781a7b329b1a747d91be3491
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ethtool: cable-test: Release RTNL when the PHY isn't found | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-27--18-00 (tests: 714)

Commit Message

Maxime Chevallier Aug. 27, 2024, 9:23 a.m. UTC
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(-)

Comments

Larysa Zaremba Aug. 27, 2024, 10:45 a.m. UTC | #1
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
> 
>
Florian Fainelli Aug. 27, 2024, 6:16 p.m. UTC | #2
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>
patchwork-bot+netdevbpf@kernel.org Aug. 29, 2024, 1 a.m. UTC | #3
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!
diff mbox series

Patch

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;