Skip to content

Commit

Permalink
bcm63xx_enet: fix sporadic kernel panic
Browse files Browse the repository at this point in the history
In ndo_stop functions, netdev_completed_queue() is called during forced
tx reclaim, after netdev_reset_queue(). This may trigger kernel panic if
there is any tx skb left.

This patch moves netdev_reset_queue() to after tx reclaim, so BQL can
complete successfully then reset.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
Fixes: 4c59b0f ("bcm63xx_enet: add BQL support")
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210222013530.1356-1-liew.s.piaw@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Sieng Piaw Liew authored and Jakub Kicinski committed Feb 23, 2021
1 parent ee576c4 commit 9bc1ef6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/ethernet/broadcom/bcm63xx_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,6 @@ static int bcm_enet_stop(struct net_device *dev)
kdev = &priv->pdev->dev;

netif_stop_queue(dev);
netdev_reset_queue(dev);
napi_disable(&priv->napi);
if (priv->has_phy)
phy_stop(dev->phydev);
Expand Down Expand Up @@ -1231,6 +1230,9 @@ static int bcm_enet_stop(struct net_device *dev)
if (priv->has_phy)
phy_disconnect(dev->phydev);

/* reset BQL after forced tx reclaim to prevent kernel panic */
netdev_reset_queue(dev);

return 0;
}

Expand Down Expand Up @@ -2343,7 +2345,6 @@ static int bcm_enetsw_stop(struct net_device *dev)

del_timer_sync(&priv->swphy_poll);
netif_stop_queue(dev);
netdev_reset_queue(dev);
napi_disable(&priv->napi);
del_timer_sync(&priv->rx_timeout);

Expand Down Expand Up @@ -2371,6 +2372,9 @@ static int bcm_enetsw_stop(struct net_device *dev)
free_irq(priv->irq_tx, dev);
free_irq(priv->irq_rx, dev);

/* reset BQL after forced tx reclaim to prevent kernel panic */
netdev_reset_queue(dev);

return 0;
}

Expand Down

0 comments on commit 9bc1ef6

Please sign in to comment.