6e115834eb891167368395f517ec0da5058ab7ef
[openwrt/staging/stintel.git] / target / linux / generic / backport-5.15 / 775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch
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
6
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
10 to be processed.
11
12 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
13 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 ---
15 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
19 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
20 @@ -3834,8 +3834,6 @@ static int stmmac_release(struct net_dev
21 struct stmmac_priv *priv = netdev_priv(dev);
22 u32 chan;
23
24 - netif_tx_disable(dev);
25 -
26 if (device_may_wakeup(priv->device))
27 phylink_speed_down(priv->phylink, false);
28 /* Stop and disconnect the PHY */
29 @@ -3847,6 +3845,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);
32
33 + netif_tx_disable(dev);
34 +
35 /* Free the IRQ lines */
36 stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);
37