Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kirjanov <dkirjanov@suse.com>2019-03-20 12:46:22 +0100
committerDenis Kirjanov <dkirjanov@suse.com>2019-03-21 09:42:29 +0100
commitef5602d0200416cb9e3774f6493be0d2faf1a79e (patch)
treec4ef023d98b6be78f20a1dcaf039661e29547c04
parentcc2e069c0212b785596416176a758b73bb89b89d (diff)
net: stmmac: Fix a race in EEE enable callback (git-fixes).
-rw-r--r--patches.fixes/0001-net-stmmac-Fix-a-race-in-EEE-enable-callback.patch65
-rw-r--r--series.conf1
2 files changed, 66 insertions, 0 deletions
diff --git a/patches.fixes/0001-net-stmmac-Fix-a-race-in-EEE-enable-callback.patch b/patches.fixes/0001-net-stmmac-Fix-a-race-in-EEE-enable-callback.patch
new file mode 100644
index 0000000000..2626fa70e2
--- /dev/null
+++ b/patches.fixes/0001-net-stmmac-Fix-a-race-in-EEE-enable-callback.patch
@@ -0,0 +1,65 @@
+From: Jose Abreu <jose.abreu@synopsys.com>
+Subject: net: stmmac: Fix a race in EEE enable callback
+Patch-mainline: v5.0-rc8
+Git-commit: 8a7493e58ad688eb23b81e45461c5d314f4402f1
+References: git-fixes
+
+We are saving the status of EEE even before we try to enable it. This
+leads to a race with XMIT function that tries to arm EEE timer before we
+set it up.
+
+Fix this by only saving the EEE parameters after all operations are
+performed with success.
+
+Signed-off-by: Jose Abreu <joabreu@synopsys.com>
+Fixes: d765955d2ae0 ("stmmac: add the Energy Efficient Ethernet support")
+Cc: Joao Pinto <jpinto@synopsys.com>
+Cc: David S. Miller <davem@davemloft.net>
+Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Denis Kirjanov <dkirjanov@suse.com>
+---
+ drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 22 ++++++++++---------
+ 1 file changed, 12 insertions(+), 10 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+@@ -670,25 +670,27 @@ static int stmmac_ethtool_op_set_eee(str
+ struct ethtool_eee *edata)
+ {
+ struct stmmac_priv *priv = netdev_priv(dev);
++ int ret;
+
+- priv->eee_enabled = edata->eee_enabled;
+-
+- if (!priv->eee_enabled)
++ if (!edata->eee_enabled) {
+ stmmac_disable_eee_mode(priv);
+- else {
++ } else {
+ /* We are asking for enabling the EEE but it is safe
+ * to verify all by invoking the eee_init function.
+ * In case of failure it will return an error.
+ */
+- priv->eee_enabled = stmmac_eee_init(priv);
+- if (!priv->eee_enabled)
++ edata->eee_enabled = stmmac_eee_init(priv);
++ if (!edata->eee_enabled)
+ return -EOPNOTSUPP;
+-
+- /* Do not change tx_lpi_timer in case of failure */
+- priv->tx_lpi_timer = edata->tx_lpi_timer;
+ }
+
+- return phy_ethtool_set_eee(dev->phydev, edata);
++ ret = phy_ethtool_set_eee(dev->phydev, edata);
++ if (ret)
++ return ret;
++
++ priv->eee_enabled = edata->eee_enabled;
++ priv->tx_lpi_timer = edata->tx_lpi_timer;
++ return 0;
+ }
+
+ static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
diff --git a/series.conf b/series.conf
index 9d8b738f52..7ae5894cd6 100644
--- a/series.conf
+++ b/series.conf
@@ -20706,6 +20706,7 @@
patches.fixes/mac80211-Free-mpath-object-when-rhashtable-insertion.patch
patches.fixes/mac80211-Restore-vif-beacon-interval-if-start-ap-fai.patch
patches.fixes/net-crypto-set-sk-to-NULL-when-af_alg_release.patch
+ patches.fixes/0001-net-stmmac-Fix-a-race-in-EEE-enable-callback.patch
patches.fixes/vhost-correctly-check-the-return-value-of-translate_.patch
patches.fixes/sky2-Increase-D3-delay-again.patch
patches.fixes/KEYS-allow-reaching-the-keys-quotas-exactly.patch