Patch "net: pxa168_eth: Fix a potential data race in pxa168_eth_remove" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: pxa168_eth: Fix a potential data race in pxa168_eth_remove

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-pxa168_eth-fix-a-potential-data-race-in-pxa168_e.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a7172ba5a18f4e69fbdcd48663565dafa61706c1
Author: Pavel Andrianov <andrianov@xxxxxxxxx>
Date:   Wed Mar 10 11:10:46 2021 +0300

    net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
    
    [ Upstream commit 0571a753cb07982cc82f4a5115e0b321da89e1f3 ]
    
    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@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 7ace07dad6a3..9986f88618bd 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1577,8 +1577,8 @@ static int pxa168_eth_remove(struct platform_device *pdev)
 
 	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;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux