summaryrefslogtreecommitdiff
path: root/drivers/net/loopback.c
diff options
context:
space:
mode:
authorKevin Groeneveld <kgroeneveld@gmail.com>2012-07-21 06:30:50 +0000
committerDavid S. Miller <davem@davemloft.net>2012-07-22 12:12:32 -0700
commite3906486f616da7cc086a3ba06c0df4e5a48b4ab (patch)
tree573b6a99cf6f1e2958c59223d2e77ebe36e71ffa /drivers/net/loopback.c
parent0980e56e506b1e45022fad00bca8c8a974fda4e6 (diff)
downloadlinux-3.10-e3906486f616da7cc086a3ba06c0df4e5a48b4ab.tar.gz
linux-3.10-e3906486f616da7cc086a3ba06c0df4e5a48b4ab.tar.bz2
linux-3.10-e3906486f616da7cc086a3ba06c0df4e5a48b4ab.zip
net: fix race condition in several drivers when reading stats
Fix race condition in several network drivers when reading stats on 32bit UP architectures. These drivers update their stats in a BH context and therefore should use u64_stats_fetch_begin_bh/u64_stats_fetch_retry_bh instead of u64_stats_fetch_begin/u64_stats_fetch_retry when reading the stats. Signed-off-by: Kevin Groeneveld <kgroeneveld@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/loopback.c')
-rw-r--r--drivers/net/loopback.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 32eb94ece6c..e2a06fd996d 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -107,10 +107,10 @@ static struct rtnl_link_stats64 *loopback_get_stats64(struct net_device *dev,
lb_stats = per_cpu_ptr(dev->lstats, i);
do {
- start = u64_stats_fetch_begin(&lb_stats->syncp);
+ start = u64_stats_fetch_begin_bh(&lb_stats->syncp);
tbytes = lb_stats->bytes;
tpackets = lb_stats->packets;
- } while (u64_stats_fetch_retry(&lb_stats->syncp, start));
+ } while (u64_stats_fetch_retry_bh(&lb_stats->syncp, start));
bytes += tbytes;
packets += tpackets;
}