775-v6.0-02-net-ethernet-stmicro-stmmac-first-disable-all-queues.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 7028471edb646bfc532fec0973e50e784cdcb7c6 Mon Sep 17 00:00:00 2001
  2. From: Christian Marangi <[email protected]>
  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. Disable all queues and disconnect before tx_disable in stmmac_release to
  7. prevent a corner case where packet may be still queued at the same time
  8. tx_disable is called resulting in kernel panic if some packet still has
  9. to be processed.
  10. Signed-off-by: Christian Marangi <[email protected]>
  11. Signed-off-by: Jakub Kicinski <[email protected]>
  12. ---
  13. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
  14. 1 file changed, 2 insertions(+), 2 deletions(-)
  15. --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  16. +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  17. @@ -3834,8 +3834,6 @@ static int stmmac_release(struct net_dev
  18. struct stmmac_priv *priv = netdev_priv(dev);
  19. u32 chan;
  20. - netif_tx_disable(dev);
  21. -
  22. if (device_may_wakeup(priv->device))
  23. phylink_speed_down(priv->phylink, false);
  24. /* Stop and disconnect the PHY */
  25. @@ -3847,6 +3845,8 @@ static int stmmac_release(struct net_dev
  26. for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
  27. hrtimer_cancel(&priv->tx_queue[chan].txtimer);
  28. + netif_tx_disable(dev);
  29. +
  30. /* Free the IRQ lines */
  31. stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);