Skip to content

Commit f0ed115

Browse files
PavelAndrianovgregkh
authored andcommitted
net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
[ Upstream commit 0571a75 ] 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 <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 4b4ce98 commit f0ed115

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/marvell/pxa168_eth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,8 +1544,8 @@ static int pxa168_eth_remove(struct platform_device *pdev)
15441544
clk_disable_unprepare(pep->clk);
15451545
mdiobus_unregister(pep->smi_bus);
15461546
mdiobus_free(pep->smi_bus);
1547-
unregister_netdev(dev);
15481547
cancel_work_sync(&pep->tx_timeout_task);
1548+
unregister_netdev(dev);
15491549
free_netdev(dev);
15501550
return 0;
15511551
}

0 commit comments

Comments
 (0)