Skip to content

Commit

Permalink
hv_netvsc: Fix a warning of suspicious RCU usage
Browse files Browse the repository at this point in the history
This fixes a warning of "suspicious rcu_dereference_check() usage"
when nload runs.

Fixes: 776e726 ("netvsc: fix RCU warning in get_stats")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dexuan Cui authored and David S. Miller committed Aug 9, 2019
1 parent 9566e65 commit 6d0d779
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/hyperv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,12 +1239,15 @@ static void netvsc_get_stats64(struct net_device *net,
struct rtnl_link_stats64 *t)
{
struct net_device_context *ndev_ctx = netdev_priv(net);
struct netvsc_device *nvdev = rcu_dereference_rtnl(ndev_ctx->nvdev);
struct netvsc_device *nvdev;
struct netvsc_vf_pcpu_stats vf_tot;
int i;

rcu_read_lock();

nvdev = rcu_dereference(ndev_ctx->nvdev);
if (!nvdev)
return;
goto out;

netdev_stats_to_stats64(t, &net->stats);

Expand Down Expand Up @@ -1283,6 +1286,8 @@ static void netvsc_get_stats64(struct net_device *net,
t->rx_packets += packets;
t->multicast += multicast;
}
out:
rcu_read_unlock();
}

static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
Expand Down

0 comments on commit 6d0d779

Please sign in to comment.