[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230309035641.3439953-1-zyytlz.wz@163.com>
Date: Thu, 9 Mar 2023 11:56:41 +0800
From: Zheng Wang <zyytlz.wz@....com>
To: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hackerzheng666@...il.com,
1395428693sheep@...il.com, alex000young@...il.com,
Zheng Wang <zyytlz.wz@....com>
Subject: [PATCH] net: calxeda: fix race condition in xgmac_remove due to unfinshed work
In xgmac_probe, the priv->tx_timeout_work is bound with
xgmac_tx_timeout_work. In xgmac_remove, if there is an
unfinished work, there might be a race condition that
priv->base was written byte after iounmap it.
Fix it by finishing the work before cleanup.
Signed-off-by: Zheng Wang <zyytlz.wz@....com>
---
drivers/net/ethernet/calxeda/xgmac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index f4f87dfa9687..94c3804001e3 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1831,6 +1831,7 @@ static int xgmac_remove(struct platform_device *pdev)
/* Free the IRQ lines */
free_irq(ndev->irq, ndev);
free_irq(priv->pmt_irq, ndev);
+ cancel_work_sync(&priv->tx_timeout_work);
unregister_netdev(ndev);
netif_napi_del(&priv->napi);
--
2.25.1
Powered by blists - more mailing lists