Commit c718af2d authored by Russell King's avatar Russell King Committed by David S. Miller

net: phylink: fix ethtool -A with attached PHYs

Fix a phylink's ethtool set_pauseparam support deadlock caused by phylib
interacting with phylink: we must not hold the state lock while calling
phylib functions that may call into phylink_phy_change().

Fixes: f904f15e ("net: phylink: allow ethtool -A to change flow control advertisement")
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 41b14fb8
...@@ -1502,18 +1502,20 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl, ...@@ -1502,18 +1502,20 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
linkmode_set_pause(config->advertising, pause->tx_pause, linkmode_set_pause(config->advertising, pause->tx_pause,
pause->rx_pause); pause->rx_pause);
/* If we have a PHY, phylib will call our link state function if the if (!pl->phydev && !test_bit(PHYLINK_DISABLE_STOPPED,
* mode has changed, which will trigger a resolve and update the MAC &pl->phylink_disable_state))
* configuration. phylink_pcs_config(pl, true, &pl->link_config);
mutex_unlock(&pl->state_mutex);
/* If we have a PHY, a change of the pause frame advertisement will
* cause phylib to renegotiate (if AN is enabled) which will in turn
* call our phylink_phy_change() and trigger a resolve. Note that
* we can't hold our state mutex while calling phy_set_asym_pause().
*/ */
if (pl->phydev) { if (pl->phydev)
phy_set_asym_pause(pl->phydev, pause->rx_pause, phy_set_asym_pause(pl->phydev, pause->rx_pause,
pause->tx_pause); pause->tx_pause);
} else if (!test_bit(PHYLINK_DISABLE_STOPPED,
&pl->phylink_disable_state)) {
phylink_pcs_config(pl, true, &pl->link_config);
}
mutex_unlock(&pl->state_mutex);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment