diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-09-05 08:58:29 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-09-05 08:58:29 +0100 |
commit | 1df726ef0a700587a712a3660b2caa8e533c7de9 (patch) | |
tree | 02086e08de0cb385a332833bdc14b7c12c92b50a /drivers/net | |
parent | fb492c9160f3d40d09456a79cc669fba74d7d9cc (diff) | |
download | blackbird-op-linux-1df726ef0a700587a712a3660b2caa8e533c7de9.tar.gz blackbird-op-linux-1df726ef0a700587a712a3660b2caa8e533c7de9.zip |
NET: am79c961: fix race in link status code
The link status code operates from a timer, and writes the index
register without first taking a lock. A well-placed interrupt
between writing the index register and reading the data register
could change the index register on us, which will return wrong data.
Add the necessary lock.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/arm/am79c961a.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index 52fe21e1e2cd..3b1416e3d217 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c @@ -308,8 +308,11 @@ static void am79c961_timer(unsigned long data) struct net_device *dev = (struct net_device *)data; struct dev_priv *priv = netdev_priv(dev); unsigned int lnkstat, carrier; + unsigned long flags; + spin_lock_irqsave(&priv->chip_lock, flags); lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; + spin_unlock_irqrestore(&priv->chip_lock, flags); carrier = netif_carrier_ok(dev); if (lnkstat && !carrier) { |