diff options
author | Kevin Groeneveld <kgroeneveld@gmail.com> | 2012-07-21 02:30:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-22 15:12:32 -0400 |
commit | e3906486f616da7cc086a3ba06c0df4e5a48b4ab (patch) | |
tree | 573b6a99cf6f1e2958c59223d2e77ebe36e71ffa /net/bridge/br_device.c | |
parent | 0980e56e506b1e45022fad00bca8c8a974fda4e6 (diff) |
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 'net/bridge/br_device.c')
-rw-r--r-- | net/bridge/br_device.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index f4be1bbfef26..333484537600 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -127,9 +127,9 @@ static struct rtnl_link_stats64 *br_get_stats64(struct net_device *dev, | |||
127 | const struct br_cpu_netstats *bstats | 127 | const struct br_cpu_netstats *bstats |
128 | = per_cpu_ptr(br->stats, cpu); | 128 | = per_cpu_ptr(br->stats, cpu); |
129 | do { | 129 | do { |
130 | start = u64_stats_fetch_begin(&bstats->syncp); | 130 | start = u64_stats_fetch_begin_bh(&bstats->syncp); |
131 | memcpy(&tmp, bstats, sizeof(tmp)); | 131 | memcpy(&tmp, bstats, sizeof(tmp)); |
132 | } while (u64_stats_fetch_retry(&bstats->syncp, start)); | 132 | } while (u64_stats_fetch_retry_bh(&bstats->syncp, start)); |
133 | sum.tx_bytes += tmp.tx_bytes; | 133 | sum.tx_bytes += tmp.tx_bytes; |
134 | sum.tx_packets += tmp.tx_packets; | 134 | sum.tx_packets += tmp.tx_packets; |
135 | sum.rx_bytes += tmp.rx_bytes; | 135 | sum.rx_bytes += tmp.rx_bytes; |