]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: ethtool: cable-test: Release RTNL when the PHY isn't found
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Tue, 27 Aug 2024 09:23:13 +0000 (11:23 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 29 Aug 2024 00:18:53 +0000 (17:18 -0700)
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: Larysa Zaremba <larysa.zaremba@intel.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20240827092314.2500284-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/cabletest.c

index 3a91b65c1f9a70f8e8980f336fb1c6112734e759..f22051f33868ac1155252a8605a4ff8a858e5dbe 100644 (file)
@@ -342,9 +342,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;