]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ethtool: use phydev variable
authorTom Rix <trix@redhat.com>
Wed, 5 Jan 2022 14:10:20 +0000 (06:10 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:44 +0000 (13:09 +0100)
[ Upstream commit ccd21ec5b8dd9b8a528a70315cee95fc1dd79d20 ]

In ethtool_get_phy_stats(), the phydev varaible is set to
dev->phydev but dev->phydev is still used.  Replace
dev->phydev uses with phydev.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: 7b07be1ff1cb ("ethtool: Avoid overflowing userspace buffer on stats query")
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ethtool/ioctl.c

index 1e9e70a633d1ca432d1f37a1ff12bfd60b6dd008..4b736385912efe3cc8833d1c39ad1a97ef1983aa 100644 (file)
@@ -2068,9 +2068,9 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr)
        if (!phydev && (!ops->get_ethtool_phy_stats || !ops->get_sset_count))
                return -EOPNOTSUPP;
 
-       if (dev->phydev && !ops->get_ethtool_phy_stats &&
+       if (phydev && !ops->get_ethtool_phy_stats &&
            phy_ops && phy_ops->get_sset_count)
-               n_stats = phy_ops->get_sset_count(dev->phydev);
+               n_stats = phy_ops->get_sset_count(phydev);
        else
                n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);
        if (n_stats < 0)
@@ -2090,9 +2090,9 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr)
                if (!data)
                        return -ENOMEM;
 
-               if (dev->phydev && !ops->get_ethtool_phy_stats &&
+               if (phydev && !ops->get_ethtool_phy_stats &&
                    phy_ops && phy_ops->get_stats) {
-                       ret = phy_ops->get_stats(dev->phydev, &stats, data);
+                       ret = phy_ops->get_stats(phydev, &stats, data);
                        if (ret < 0)
                                goto out;
                } else {