mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
lan743x: fix deadlock in lan743x_phy_link_status_change()
[ Upstream commitddb826c2c9] Usage of phy_ethtool_get_link_ksettings() in the link status change handler isn't needed, and in combination with the referenced change it results in a deadlock. Simply remove the call and replace it with direct access to phydev->speed. The duplex argument of lan743x_phy_update_flowcontrol() isn't used and can be removed. Fixes:c10a485c3d("phy: phy_ethtool_ksettings_get: Lock the phy for consistency") Reported-by: Alessandro B Maurici <abmaurici@gmail.com> Tested-by: Alessandro B Maurici <abmaurici@gmail.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/40e27f76-0ba3-dcef-ee32-a78b9df38b0f@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c5e4316d9c
commit
95ba8f0d57
|
|
@ -922,8 +922,7 @@ static int lan743x_phy_reset(struct lan743x_adapter *adapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lan743x_phy_update_flowcontrol(struct lan743x_adapter *adapter,
|
static void lan743x_phy_update_flowcontrol(struct lan743x_adapter *adapter,
|
||||||
u8 duplex, u16 local_adv,
|
u16 local_adv, u16 remote_adv)
|
||||||
u16 remote_adv)
|
|
||||||
{
|
{
|
||||||
struct lan743x_phy *phy = &adapter->phy;
|
struct lan743x_phy *phy = &adapter->phy;
|
||||||
u8 cap;
|
u8 cap;
|
||||||
|
|
@ -951,7 +950,6 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
|
||||||
|
|
||||||
phy_print_status(phydev);
|
phy_print_status(phydev);
|
||||||
if (phydev->state == PHY_RUNNING) {
|
if (phydev->state == PHY_RUNNING) {
|
||||||
struct ethtool_link_ksettings ksettings;
|
|
||||||
int remote_advertisement = 0;
|
int remote_advertisement = 0;
|
||||||
int local_advertisement = 0;
|
int local_advertisement = 0;
|
||||||
|
|
||||||
|
|
@ -988,18 +986,14 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
|
||||||
}
|
}
|
||||||
lan743x_csr_write(adapter, MAC_CR, data);
|
lan743x_csr_write(adapter, MAC_CR, data);
|
||||||
|
|
||||||
memset(&ksettings, 0, sizeof(ksettings));
|
|
||||||
phy_ethtool_get_link_ksettings(netdev, &ksettings);
|
|
||||||
local_advertisement =
|
local_advertisement =
|
||||||
linkmode_adv_to_mii_adv_t(phydev->advertising);
|
linkmode_adv_to_mii_adv_t(phydev->advertising);
|
||||||
remote_advertisement =
|
remote_advertisement =
|
||||||
linkmode_adv_to_mii_adv_t(phydev->lp_advertising);
|
linkmode_adv_to_mii_adv_t(phydev->lp_advertising);
|
||||||
|
|
||||||
lan743x_phy_update_flowcontrol(adapter,
|
lan743x_phy_update_flowcontrol(adapter, local_advertisement,
|
||||||
ksettings.base.duplex,
|
|
||||||
local_advertisement,
|
|
||||||
remote_advertisement);
|
remote_advertisement);
|
||||||
lan743x_ptp_update_latency(adapter, ksettings.base.speed);
|
lan743x_ptp_update_latency(adapter, phydev->speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user