Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: fix phy_disable_eee

genphy_c45_write_eee_adv() becomes a no-op if phydev->supported_eee
is cleared. That's not what we want because this function is still
needed to clear the EEE advertisement register(s).
Fill phydev->eee_broken_modes instead to ensure that userspace
can't re-enable EEE advertising.

Fixes: b55498ff14bd ("net: phy: add phy_disable_eee")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/57e2ae5f-4319-413c-b5c4-ebc8d049bc23@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
c83ca5a4 9268abe6

+2 -1
+2 -1
drivers/net/phy/phy_device.c
··· 3012 3012 */ 3013 3013 void phy_disable_eee(struct phy_device *phydev) 3014 3014 { 3015 - linkmode_zero(phydev->supported_eee); 3016 3015 linkmode_zero(phydev->advertising_eee); 3017 3016 phydev->eee_cfg.tx_lpi_enabled = false; 3018 3017 phydev->eee_cfg.eee_enabled = false; 3018 + /* don't let userspace re-enable EEE advertisement */ 3019 + linkmode_fill(phydev->eee_broken_modes); 3019 3020 } 3020 3021 EXPORT_SYMBOL_GPL(phy_disable_eee); 3021 3022