net: phy: Fix ioctl handler when modifing MII_ADVERTISE
authorAndrew Lunn <andrew@lunn.ch>
Wed, 5 Dec 2018 20:49:45 +0000 (21:49 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Dec 2018 00:26:16 +0000 (16:26 -0800)
When the MII_ADVERTISE register is modified by the IOCTL handler,
phydev->advertising needs recalculating. Use the _mod_ variant of
mii_adv_to_linkmode_adv_t so that bits outside of the advertise
registers are not cleared.

Fixes: c0ec3c273677 ("net: phy: Convert u32 phydev->lp_advertising to linkmode")
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c

index e1a1e54baac27e2b0f0dfb9e6e76ecb4f90942fa..e24708f1fc16238091acb8081889bdbd2743ae2c 100644 (file)
@@ -437,8 +437,8 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
                                }
                                break;
                        case MII_ADVERTISE:
-                               mii_adv_to_linkmode_adv_t(phydev->advertising,
-                                                         val);
+                               mii_adv_mod_linkmode_adv_t(phydev->advertising,
+                                                          val);
                                change_autoneg = true;
                                break;
                        default: