netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1 v2] mvpp2: remove module bugfix
@ 2020-06-16  4:35 Sven Auhagen
  2020-06-16 20:42 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Auhagen @ 2020-06-16  4:35 UTC (permalink / raw)
  To: netdev
  Cc: antoine.tenart, gregory.clement, maxime.chevallier,
	thomas.petazzoni, miquel.raynal, mw, lorenzo, technoboy85

The remove function does not destroy all
BM Pools when per cpu pool is active.

When reloading the mvpp2 as a module the BM Pools
are still active in hardware and due to the bug
have twice the size now old + new.

This eventually leads to a kernel crash.

v2:
* add Fixes tag

Fixes: 7d04b0b13b11 ("mvpp2: percpu buffers")
Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 2b5dad2ec650..9d08312c1c47 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5984,7 +5984,7 @@ static int mvpp2_remove(struct platform_device *pdev)
 	struct mvpp2 *priv = platform_get_drvdata(pdev);
 	struct fwnode_handle *fwnode = pdev->dev.fwnode;
 	struct fwnode_handle *port_fwnode;
-	int i = 0;
+	int i = 0, poolnum = MVPP2_BM_POOLS_NUM;
 
 	mvpp2_dbgfs_cleanup(priv);
 
@@ -5998,7 +5998,10 @@ static int mvpp2_remove(struct platform_device *pdev)
 
 	destroy_workqueue(priv->stats_queue);
 
-	for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) {
+	if (priv->percpu_pools)
+		poolnum = mvpp2_get_nrxqs(priv) * 2;
+
+	for (i = 0; i < poolnum; i++) {
 		struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i];
 
 		mvpp2_bm_pool_destroy(&pdev->dev, priv, bm_pool);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1 v2] mvpp2: remove module bugfix
  2020-06-16  4:35 [PATCH 1/1 v2] mvpp2: remove module bugfix Sven Auhagen
@ 2020-06-16 20:42 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-06-16 20:42 UTC (permalink / raw)
  To: sven.auhagen
  Cc: netdev, antoine.tenart, gregory.clement, maxime.chevallier,
	thomas.petazzoni, miquel.raynal, mw, lorenzo, technoboy85

From: Sven Auhagen <sven.auhagen@voleatech.de>
Date: Tue, 16 Jun 2020 06:35:29 +0200

> The remove function does not destroy all
> BM Pools when per cpu pool is active.
> 
> When reloading the mvpp2 as a module the BM Pools
> are still active in hardware and due to the bug
> have twice the size now old + new.
> 
> This eventually leads to a kernel crash.
> 
> v2:
> * add Fixes tag
> 
> Fixes: 7d04b0b13b11 ("mvpp2: percpu buffers")
> Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-16 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16  4:35 [PATCH 1/1 v2] mvpp2: remove module bugfix Sven Auhagen
2020-06-16 20:42 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).