]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: ethernet: stmicro: stmmac: first disable all queues and disconnect in release
authorChristian Marangi <ansuelsmth@gmail.com>
Sat, 23 Jul 2022 14:29:30 +0000 (16:29 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 26 Jul 2022 02:38:56 +0000 (19:38 -0700)
Disable all queues and disconnect before tx_disable in stmmac_release to
prevent a corner case where packet may be still queued at the same time
tx_disable is called resulting in kernel panic if some packet still has
to be processed.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 5d08d09a9d516808d6ead8e5e782d3a2fd409c45..5bd2e4d47ac5ba80bede7c5fa9ba9da21ad14b16 100644 (file)
@@ -3757,8 +3757,6 @@ static int stmmac_release(struct net_device *dev)
        struct stmmac_priv *priv = netdev_priv(dev);
        u32 chan;
 
-       netif_tx_disable(dev);
-
        if (device_may_wakeup(priv->device))
                phylink_speed_down(priv->phylink, false);
        /* Stop and disconnect the PHY */
@@ -3770,6 +3768,8 @@ static int stmmac_release(struct net_device *dev)
        for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
                hrtimer_cancel(&priv->tx_queue[chan].txtimer);
 
+       netif_tx_disable(dev);
+
        /* Free the IRQ lines */
        stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);