* [PATCH net] bcm63xx_enet: fix sporadic kernel panic
@ 2021-02-22 1:35 ` Sieng Piaw Liew
0 siblings, 0 replies; 6+ messages in thread
From: Sieng Piaw Liew @ 2021-02-22 1:35 UTC (permalink / raw)
To: davem, kuba, f.fainelli
Cc: bcm-kernel-feedback-list, netdev, linux-arm-kernel, linux-kernel,
Sieng Piaw Liew
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>
---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index fd8767213165..977f097fc7bf 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -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);
@@ -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;
}
@@ -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);
@@ -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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net] bcm63xx_enet: fix sporadic kernel panic
@ 2021-02-22 1:35 ` Sieng Piaw Liew
0 siblings, 0 replies; 6+ messages in thread
From: Sieng Piaw Liew @ 2021-02-22 1:35 UTC (permalink / raw)
To: davem, kuba, f.fainelli
Cc: netdev, bcm-kernel-feedback-list, linux-kernel, linux-arm-kernel,
Sieng Piaw Liew
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>
---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index fd8767213165..977f097fc7bf 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -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);
@@ -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;
}
@@ -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);
@@ -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;
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net] bcm63xx_enet: fix sporadic kernel panic
2021-02-22 1:35 ` Sieng Piaw Liew
@ 2021-02-22 5:05 ` Florian Fainelli
-1 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-02-22 5:05 UTC (permalink / raw)
To: Sieng Piaw Liew, davem, kuba
Cc: bcm-kernel-feedback-list, netdev, linux-arm-kernel, linux-kernel
On 2/21/2021 17:35, Sieng Piaw Liew wrote:
> 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>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
--
Florian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] bcm63xx_enet: fix sporadic kernel panic
@ 2021-02-22 5:05 ` Florian Fainelli
0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2021-02-22 5:05 UTC (permalink / raw)
To: Sieng Piaw Liew, davem, kuba
Cc: netdev, bcm-kernel-feedback-list, linux-kernel, linux-arm-kernel
On 2/21/2021 17:35, Sieng Piaw Liew wrote:
> 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>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
--
Florian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] bcm63xx_enet: fix sporadic kernel panic
2021-02-22 5:05 ` Florian Fainelli
@ 2021-02-23 20:16 ` Jakub Kicinski
-1 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2021-02-23 20:16 UTC (permalink / raw)
To: Florian Fainelli
Cc: Sieng Piaw Liew, davem, bcm-kernel-feedback-list, netdev,
linux-arm-kernel, linux-kernel
On Sun, 21 Feb 2021 21:05:50 -0800 Florian Fainelli wrote:
> On 2/21/2021 17:35, Sieng Piaw Liew wrote:
> > 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>
>
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
Applied, thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] bcm63xx_enet: fix sporadic kernel panic
@ 2021-02-23 20:16 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2021-02-23 20:16 UTC (permalink / raw)
To: Florian Fainelli
Cc: Sieng Piaw Liew, netdev, linux-kernel, bcm-kernel-feedback-list,
davem, linux-arm-kernel
On Sun, 21 Feb 2021 21:05:50 -0800 Florian Fainelli wrote:
> On 2/21/2021 17:35, Sieng Piaw Liew wrote:
> > 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>
>
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
Applied, thanks!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-02-23 20:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 1:35 [PATCH net] bcm63xx_enet: fix sporadic kernel panic Sieng Piaw Liew
2021-02-22 1:35 ` Sieng Piaw Liew
2021-02-22 5:05 ` Florian Fainelli
2021-02-22 5:05 ` Florian Fainelli
2021-02-23 20:16 ` Jakub Kicinski
2021-02-23 20:16 ` Jakub Kicinski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.