lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080926023322.GA16514@carmen.cs.uiuc.edu>
Date:	Thu, 25 Sep 2008 21:33:22 -0500
From:	Lin Tan <tammy000@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH git latest] drivers/net: fixing a datarace related to update_stats()

Fixing a datarace.

As indicated by the following comment, a lock must be held before calling 
function update_stats(). This rule is followed in some cases, but not in 
others. For example, the lock is held when the function is called in function 
el3_get_stats(), but the lock is NOT held when called in el3_close(). It can 
cause potential data races. 

/*
  ...
  
  Caller must hold the lock for this
*/
static void update_stats(struct net_device *dev)
{
...
}


Signed-off-by: Lin Tan <tammy000@...il.com>

---

--- a/drivers/net/pcmcia/3c589_cs.c	2008-09-25 11:52:42.000000000 -0500
+++ b/drivers/net/pcmcia/3c589_cs.c	2008-09-25 13:01:44.000000000 -0500
@@ -920,6 +920,7 @@ static int el3_close(struct net_device *
     struct el3_private *lp = netdev_priv(dev);
     struct pcmcia_device *link = lp->p_dev;
     unsigned int ioaddr = dev->base_addr;
+    unsigned long flags;
     
     DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
 
@@ -947,7 +948,9 @@ static int el3_close(struct net_device *
         
 	/* Check if the card still exists */
 	if ((inw(ioaddr+EL3_STATUS) & 0xe000) == 0x2000)
+    	    spin_lock_irqsave(&lp->lock, flags);
 	    update_stats(dev);
+    	    spin_unlock_irqrestore(&lp->lock, flags);
     }
 
     link->open--;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ