提交 35a57b7f 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

hv_netvsc: fix locking for rx_mode

The rx_mode operation handler is different than other callbacks
in that is not always called with rtnl held. Therefore use
RCU to ensure that references are valid.

Fixes: bee9d41b ("hv_netvsc: propagate rx filters to VF")
Signed-off-by: NStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7eeb4a6e
...@@ -89,15 +89,20 @@ static void netvsc_change_rx_flags(struct net_device *net, int change) ...@@ -89,15 +89,20 @@ static void netvsc_change_rx_flags(struct net_device *net, int change)
static void netvsc_set_rx_mode(struct net_device *net) static void netvsc_set_rx_mode(struct net_device *net)
{ {
struct net_device_context *ndev_ctx = netdev_priv(net); struct net_device_context *ndev_ctx = netdev_priv(net);
struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); struct net_device *vf_netdev;
struct netvsc_device *nvdev = rtnl_dereference(ndev_ctx->nvdev); struct netvsc_device *nvdev;
rcu_read_lock();
vf_netdev = rcu_dereference(ndev_ctx->vf_netdev);
if (vf_netdev) { if (vf_netdev) {
dev_uc_sync(vf_netdev, net); dev_uc_sync(vf_netdev, net);
dev_mc_sync(vf_netdev, net); dev_mc_sync(vf_netdev, net);
} }
rndis_filter_update(nvdev); nvdev = rcu_dereference(ndev_ctx->nvdev);
if (nvdev)
rndis_filter_update(nvdev);
rcu_read_unlock();
} }
static int netvsc_open(struct net_device *net) static int netvsc_open(struct net_device *net)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册