]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.5-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Mar 2020 12:18:51 +0000 (13:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Mar 2020 12:18:51 +0000 (13:18 +0100)
added patches:
net-stmmac-fix-notifier-registration.patch

queue-5.5/net-stmmac-fix-notifier-registration.patch [new file with mode: 0644]
queue-5.5/series

diff --git a/queue-5.5/net-stmmac-fix-notifier-registration.patch b/queue-5.5/net-stmmac-fix-notifier-registration.patch
new file mode 100644 (file)
index 0000000..2bd59f4
--- /dev/null
@@ -0,0 +1,83 @@
+From 474a31e13a4e9749fb3ee55794d69d0f17ee0998 Mon Sep 17 00:00:00 2001
+From: Aaro Koskinen <aaro.koskinen@nokia.com>
+Date: Wed, 26 Feb 2020 18:49:01 +0200
+Subject: net: stmmac: fix notifier registration
+
+From: Aaro Koskinen <aaro.koskinen@nokia.com>
+
+commit 474a31e13a4e9749fb3ee55794d69d0f17ee0998 upstream.
+
+We cannot register the same netdev notifier multiple times when probing
+stmmac devices. Register the notifier only once in module init, and also
+make debugfs creation/deletion safe against simultaneous notifier call.
+
+Fixes: 481a7d154cbb ("stmmac: debugfs entry name is not be changed when udev rename device name.")
+Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |   13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+@@ -4289,6 +4289,8 @@ static void stmmac_init_fs(struct net_de
+ {
+       struct stmmac_priv *priv = netdev_priv(dev);
++      rtnl_lock();
++
+       /* Create per netdev entries */
+       priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir);
+@@ -4300,14 +4302,13 @@ static void stmmac_init_fs(struct net_de
+       debugfs_create_file("dma_cap", 0444, priv->dbgfs_dir, dev,
+                           &stmmac_dma_cap_fops);
+-      register_netdevice_notifier(&stmmac_notifier);
++      rtnl_unlock();
+ }
+ static void stmmac_exit_fs(struct net_device *dev)
+ {
+       struct stmmac_priv *priv = netdev_priv(dev);
+-      unregister_netdevice_notifier(&stmmac_notifier);
+       debugfs_remove_recursive(priv->dbgfs_dir);
+ }
+ #endif /* CONFIG_DEBUG_FS */
+@@ -4825,14 +4826,14 @@ int stmmac_dvr_remove(struct device *dev
+       netdev_info(priv->dev, "%s: removing driver", __func__);
+-#ifdef CONFIG_DEBUG_FS
+-      stmmac_exit_fs(ndev);
+-#endif
+       stmmac_stop_all_dma(priv);
+       stmmac_mac_set(priv, priv->ioaddr, false);
+       netif_carrier_off(ndev);
+       unregister_netdev(ndev);
++#ifdef CONFIG_DEBUG_FS
++      stmmac_exit_fs(ndev);
++#endif
+       phylink_destroy(priv->phylink);
+       if (priv->plat->stmmac_rst)
+               reset_control_assert(priv->plat->stmmac_rst);
+@@ -5052,6 +5053,7 @@ static int __init stmmac_init(void)
+       /* Create debugfs main directory if it doesn't exist yet */
+       if (!stmmac_fs_dir)
+               stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL);
++      register_netdevice_notifier(&stmmac_notifier);
+ #endif
+       return 0;
+@@ -5060,6 +5062,7 @@ static int __init stmmac_init(void)
+ static void __exit stmmac_exit(void)
+ {
+ #ifdef CONFIG_DEBUG_FS
++      unregister_netdevice_notifier(&stmmac_notifier);
+       debugfs_remove_recursive(stmmac_fs_dir);
+ #endif
+ }
index ad2f0c6943bf778dd83bc2f82bd238b0a2651611..58a59b92c34600c29a6773a7eacf384efdb957be 100644 (file)
@@ -186,3 +186,4 @@ powerpc-fix-hardware-pmu-exception-bug-on-powervm-compatibility-mode-systems.pat
 efi-x86-align-guids-to-their-size-in-the-mixed-mode-runtime-wrapper.patch
 efi-x86-handle-by-ref-arguments-covering-multiple-pages-in-mixed-mode.patch
 efi-read_once-rng-seed-size-before-munmap.patch
+net-stmmac-fix-notifier-registration.patch