From fac7eee9996e2be917437204a1dd6093410a51c9 Mon Sep 17 00:00:00 2001 From: David Yu Date: Fri, 8 Oct 2021 02:29:25 +0000 Subject: [PATCH] NVIDIA: SAUCE: net: phy: fix data corruption BugLink: https://bugs.launchpad.net/bugs/2072591 Data corruption is happening in aqr107_config_init(). It's accessing address offset across struct phy_device boundary. This is caused by misuse of SUPPORTED_* to linkmode_*_bit() api. Change SUPPORTED_* to ETHTOOL_LINK_MODE_*_BIT for correct usage. http://nvbugs/200781153 http://nvbugs/4088909 http://nvbugs/4090066 Signed-off-by: David Yu Signed-off-by: Revanth Kumar Uppala Reviewed-by: Abhilash G Tested-by: Abhilash G Reviewed-by: Laxman Dewangan Signed-off-by: Laxman Dewangan Acked-by: Jacob Martin Acked-by: Noah Wager Signed-off-by: Noah Wager --- drivers/net/phy/aquantia/aquantia_main.c | 4 ++-- drivers/net/phy/realtek.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index cc3b220913b9..7c9f8667a34a 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -800,8 +800,8 @@ static int aqr107_config_init(struct phy_device *phydev) aqr107_chip_info(phydev); /* Advertize flow control */ - linkmode_set_bit(SUPPORTED_Pause, phydev->supported); - linkmode_set_bit(SUPPORTED_Asym_Pause, phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported); linkmode_copy(phydev->advertising, phydev->supported); /* Configure flow control */ diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 2f49a480b2de..ae696ad231b4 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -543,8 +543,8 @@ static int rtl8211f_config_init(struct phy_device *phydev) } /* Advertise Flow Control */ - linkmode_set_bit(SUPPORTED_Pause, phydev->supported); - linkmode_set_bit(SUPPORTED_Asym_Pause, phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported); linkmode_copy(phydev->advertising, phydev->supported); ret = phy_modify_paged_changed(phydev, RTL8211F_WOL_MAC_PAGE, RTL8211F_WOL_REG_MAC_WORD_0, 0x0,