1 From ca6be00ca1d3a2f5b8794894e2dae175e63768f5 Mon Sep 17 00:00:00 2001
2 From: Sieng Piaw Liew <liew.s.piaw@gmail.com>
3 Date: Tue, 16 Feb 2021 16:23:08 +0800
4 Subject: [PATCH] bcm63xx_enet: Fix sporadic kernel panic
6 In ndo_stop functions, netdev_completed_queue() is called during forced
7 tx reclaim, after netdev_reset_queue(). This may trigger kernel panic if
8 there is any tx skb left.
10 This patch moves netdev_reset_queue() to after tx reclaim, so BQL can
11 complete successfully then reset.
13 Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
15 drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 ++++++--
16 1 file changed, 6 insertions(+), 2 deletions(-)
18 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
19 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
20 @@ -1192,7 +1192,6 @@ static int bcm_enet_stop(struct net_devi
21 kdev = &priv->pdev->dev;
23 netif_stop_queue(dev);
24 - netdev_reset_queue(dev);
25 napi_disable(&priv->napi);
27 phy_stop(dev->phydev);
28 @@ -1231,6 +1230,9 @@ static int bcm_enet_stop(struct net_devi
30 phy_disconnect(dev->phydev);
32 + /* reset BQL after forced tx reclaim to not kernel panic */
33 + netdev_reset_queue(dev);
38 @@ -2343,7 +2345,6 @@ static int bcm_enetsw_stop(struct net_de
40 del_timer_sync(&priv->swphy_poll);
41 netif_stop_queue(dev);
42 - netdev_reset_queue(dev);
43 napi_disable(&priv->napi);
44 del_timer_sync(&priv->rx_timeout);
46 @@ -2371,6 +2372,9 @@ static int bcm_enetsw_stop(struct net_de
47 free_irq(priv->irq_tx, dev);
48 free_irq(priv->irq_rx, dev);
50 + /* reset BQL after forced tx reclaim to not kernel panic */
51 + netdev_reset_queue(dev);