aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorKevin Groeneveld <kgroeneveld@gmail.com>2012-07-21 02:30:50 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-22 15:12:32 -0400
commite3906486f616da7cc086a3ba06c0df4e5a48b4ab (patch)
tree573b6a99cf6f1e2958c59223d2e77ebe36e71ffa /drivers/net/virtio_net.c
parent0980e56e506b1e45022fad00bca8c8a974fda4e6 (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 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 1db445b2ecc7..83d2b0c34c5e 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -704,16 +704,16 @@ static struct rtnl_link_stats64 *virtnet_stats(struct net_device *dev,
704 u64 tpackets, tbytes, rpackets, rbytes; 704 u64 tpackets, tbytes, rpackets, rbytes;
705 705
706 do { 706 do {
707 start = u64_stats_fetch_begin(&stats->tx_syncp); 707 start = u64_stats_fetch_begin_bh(&stats->tx_syncp);
708 tpackets = stats->tx_packets; 708 tpackets = stats->tx_packets;
709 tbytes = stats->tx_bytes; 709 tbytes = stats->tx_bytes;
710 } while (u64_stats_fetch_retry(&stats->tx_syncp, start)); 710 } while (u64_stats_fetch_retry_bh(&stats->tx_syncp, start));
711 711
712 do { 712 do {
713 start = u64_stats_fetch_begin(&stats->rx_syncp); 713 start = u64_stats_fetch_begin_bh(&stats->rx_syncp);
714 rpackets = stats->rx_packets; 714 rpackets = stats->rx_packets;
715 rbytes = stats->rx_bytes; 715 rbytes = stats->rx_bytes;
716 } while (u64_stats_fetch_retry(&stats->rx_syncp, start)); 716 } while (u64_stats_fetch_retry_bh(&stats->rx_syncp, start));
717 717
718 tot->rx_packets += rpackets; 718 tot->rx_packets += rpackets;
719 tot->tx_packets += tpackets; 719 tot->tx_packets += tpackets;