* [PATCH net] lan743x: fix deadlock in lan743x_phy_link_status_change()
@ 2021-11-24 7:16 Heiner Kallweit
2021-11-24 15:30 ` Andrew Lunn
2021-11-25 2:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2021-11-24 7:16 UTC (permalink / raw)
To: Bryan Whitehead, Microchip Linux Driver Support, David Miller,
Jakub Kicinski
Cc: Andrew Lunn, netdev@vger.kernel.org, Alessandro B Maurici
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: c10a485c3de5 ("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>
---
drivers/net/ethernet/microchip/lan743x_main.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 4fc97823b..7d7647481 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -914,8 +914,7 @@ static int lan743x_phy_reset(struct lan743x_adapter *adapter)
}
static void lan743x_phy_update_flowcontrol(struct lan743x_adapter *adapter,
- u8 duplex, u16 local_adv,
- u16 remote_adv)
+ u16 local_adv, u16 remote_adv)
{
struct lan743x_phy *phy = &adapter->phy;
u8 cap;
@@ -943,7 +942,6 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
phy_print_status(phydev);
if (phydev->state == PHY_RUNNING) {
- struct ethtool_link_ksettings ksettings;
int remote_advertisement = 0;
int local_advertisement = 0;
@@ -980,18 +978,14 @@ static void lan743x_phy_link_status_change(struct net_device *netdev)
}
lan743x_csr_write(adapter, MAC_CR, data);
- memset(&ksettings, 0, sizeof(ksettings));
- phy_ethtool_get_link_ksettings(netdev, &ksettings);
local_advertisement =
linkmode_adv_to_mii_adv_t(phydev->advertising);
remote_advertisement =
linkmode_adv_to_mii_adv_t(phydev->lp_advertising);
- lan743x_phy_update_flowcontrol(adapter,
- ksettings.base.duplex,
- local_advertisement,
+ lan743x_phy_update_flowcontrol(adapter, local_advertisement,
remote_advertisement);
- lan743x_ptp_update_latency(adapter, ksettings.base.speed);
+ lan743x_ptp_update_latency(adapter, phydev->speed);
}
}
--
2.34.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] lan743x: fix deadlock in lan743x_phy_link_status_change()
2021-11-24 7:16 [PATCH net] lan743x: fix deadlock in lan743x_phy_link_status_change() Heiner Kallweit
@ 2021-11-24 15:30 ` Andrew Lunn
2021-11-25 2:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2021-11-24 15:30 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Bryan Whitehead, Microchip Linux Driver Support, David Miller,
Jakub Kicinski, netdev@vger.kernel.org, Alessandro B Maurici
On Wed, Nov 24, 2021 at 08:16:25AM +0100, Heiner Kallweit wrote:
> 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: c10a485c3de5 ("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>
Thanks Heiner
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] lan743x: fix deadlock in lan743x_phy_link_status_change()
2021-11-24 7:16 [PATCH net] lan743x: fix deadlock in lan743x_phy_link_status_change() Heiner Kallweit
2021-11-24 15:30 ` Andrew Lunn
@ 2021-11-25 2:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-25 2:50 UTC (permalink / raw)
To: Heiner Kallweit
Cc: bryan.whitehead, UNGLinuxDriver, davem, kuba, andrew, netdev,
abmaurici
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 24 Nov 2021 08:16:25 +0100 you wrote:
> 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: c10a485c3de5 ("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>
>
> [...]
Here is the summary with links:
- [net] lan743x: fix deadlock in lan743x_phy_link_status_change()
https://git.kernel.org/netdev/net/c/ddb826c2c92d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-25 2:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-24 7:16 [PATCH net] lan743x: fix deadlock in lan743x_phy_link_status_change() Heiner Kallweit
2021-11-24 15:30 ` Andrew Lunn
2021-11-25 2:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).