Skip to content

Commit ddb826c

Browse files
hkallweitkuba-moo
authored andcommitted
lan743x: fix deadlock in lan743x_phy_link_status_change()
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: c10a485 ("phy: phy_ethtool_ksettings_get: Lock the phy for consistency") Reported-by: Alessandro B Maurici <[email protected]> Tested-by: Alessandro B Maurici <[email protected]> Signed-off-by: Heiner Kallweit <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4e1fddc commit ddb826c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/net/ethernet/microchip/lan743x_main.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,7 @@ static int lan743x_phy_reset(struct lan743x_adapter *adapter)
914914
}
915915

916916
static void lan743x_phy_update_flowcontrol(struct lan743x_adapter *adapter,
917-
u8 duplex, u16 local_adv,
918-
u16 remote_adv)
917+
u16 local_adv, u16 remote_adv)
919918
{
920919
struct lan743x_phy *phy = &adapter->phy;
921920
u8 cap;
@@ -943,7 +942,6 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
943942

944943
phy_print_status(phydev);
945944
if (phydev->state == PHY_RUNNING) {
946-
struct ethtool_link_ksettings ksettings;
947945
int remote_advertisement = 0;
948946
int local_advertisement = 0;
949947

@@ -980,18 +978,14 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
980978
}
981979
lan743x_csr_write(adapter, MAC_CR, data);
982980

983-
memset(&ksettings, 0, sizeof(ksettings));
984-
phy_ethtool_get_link_ksettings(netdev, &ksettings);
985981
local_advertisement =
986982
linkmode_adv_to_mii_adv_t(phydev->advertising);
987983
remote_advertisement =
988984
linkmode_adv_to_mii_adv_t(phydev->lp_advertising);
989985

990-
lan743x_phy_update_flowcontrol(adapter,
991-
ksettings.base.duplex,
992-
local_advertisement,
986+
lan743x_phy_update_flowcontrol(adapter, local_advertisement,
993987
remote_advertisement);
994-
lan743x_ptp_update_latency(adapter, ksettings.base.speed);
988+
lan743x_ptp_update_latency(adapter, phydev->speed);
995989
}
996990
}
997991

0 commit comments

Comments
 (0)