Patch "net: appletalk: cops: Fix data race in cops_probe1" 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: appletalk: cops: Fix data race in cops_probe1

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-appletalk-cops-fix-data-race-in-cops_probe1.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 fcd06e1e4e7a17fe6429c7696028f36a78e52453
Author: Saubhik Mukherjee <saubhik.mukherjee@xxxxxxxxx>
Date:   Mon May 24 19:07:12 2021 +0530

    net: appletalk: cops: Fix data race in cops_probe1
    
    [ Upstream commit a4dd4fc6105e54393d637450a11d4cddb5fabc4f ]
    
    In cops_probe1(), there is a write to dev->base_addr after requesting an
    interrupt line and registering the interrupt handler cops_interrupt().
    The handler might be called in parallel to handle an interrupt.
    cops_interrupt() tries to read dev->base_addr leading to a potential
    data race. So write to dev->base_addr before calling request_irq().
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Signed-off-by: Saubhik Mukherjee <saubhik.mukherjee@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 7f2a032c354c..841a5de58c7c 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -324,6 +324,8 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
 			break;
 	}
 
+	dev->base_addr = ioaddr;
+
 	/* Reserve any actual interrupt. */
 	if (dev->irq) {
 		retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev);
@@ -331,8 +333,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
 			goto err_out;
 	}
 
-	dev->base_addr = ioaddr;
-
         lp = netdev_priv(dev);
         spin_lock_init(&lp->lock);
 



[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