1 From 7028471edb646bfc532fec0973e50e784cdcb7c6 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sat, 23 Jul 2022 16:29:30 +0200
4 Subject: [PATCH 2/5] net: ethernet: stmicro: stmmac: first disable all queues
5 and disconnect in release
7 Disable all queues and disconnect before tx_disable in stmmac_release to
8 prevent a corner case where packet may be still queued at the same time
9 tx_disable is called resulting in kernel panic if some packet still has
12 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
13 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
15 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
18 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
19 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
20 @@ -3837,8 +3837,6 @@ static int stmmac_release(struct net_dev
21 struct stmmac_priv *priv = netdev_priv(dev);
24 - netif_tx_disable(dev);
26 if (device_may_wakeup(priv->device))
27 phylink_speed_down(priv->phylink, false);
28 /* Stop and disconnect the PHY */
29 @@ -3850,6 +3848,8 @@ static int stmmac_release(struct net_dev
30 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
31 hrtimer_cancel(&priv->tx_queue[chan].txtimer);
33 + netif_tx_disable(dev);
35 /* Free the IRQ lines */
36 stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);