summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/marvell/pxa168_eth.c
diff options
context:
space:
mode:
authorPavel Andrianov <andrianov@ispras.ru>2021-03-10 11:10:46 +0300
committerDavid S. Miller <davem@davemloft.net>2021-03-11 02:21:33 +0300
commit0571a753cb07982cc82f4a5115e0b321da89e1f3 (patch)
treef750240bc836f82885e9dbb96e2a3bcd0af8bb21 /drivers/net/ethernet/marvell/pxa168_eth.c
parentdd4fa1dae9f4847cc1fd78ca468ad69e16e5db3e (diff)
downloadlinux-0571a753cb07982cc82f4a5115e0b321da89e1f3.tar.xz
net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
pxa168_eth_remove() firstly calls unregister_netdev(), then cancels a timeout work. unregister_netdev() shuts down a device interface and removes it from the kernel tables. If the timeout occurs in parallel, the timeout work (pxa168_eth_tx_timeout_task) performs stop and open of the device. It may lead to an inconsistent state and memory leaks. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Pavel Andrianov <andrianov@ispras.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/pxa168_eth.c')
-rw-r--r--drivers/net/ethernet/marvell/pxa168_eth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index d1e4d42e497d..3712e1786091 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1544,8 +1544,8 @@ static int pxa168_eth_remove(struct platform_device *pdev)
clk_disable_unprepare(pep->clk);
mdiobus_unregister(pep->smi_bus);
mdiobus_free(pep->smi_bus);
- unregister_netdev(dev);
cancel_work_sync(&pep->tx_timeout_task);
+ unregister_netdev(dev);
free_netdev(dev);
return 0;
}