Commit 79e8cbe7 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

netvsc: add some rtnl_dereference annotations

In a couple places RTNL is held, and the netvsc_device pointer
is acquired without annotation.
Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1b01994a
...@@ -41,7 +41,7 @@ void netvsc_switch_datapath(struct net_device *ndev, bool vf) ...@@ -41,7 +41,7 @@ void netvsc_switch_datapath(struct net_device *ndev, bool vf)
{ {
struct net_device_context *net_device_ctx = netdev_priv(ndev); struct net_device_context *net_device_ctx = netdev_priv(ndev);
struct hv_device *dev = net_device_ctx->device_ctx; struct hv_device *dev = net_device_ctx->device_ctx;
struct netvsc_device *nv_dev = net_device_ctx->nvdev; struct netvsc_device *nv_dev = rtnl_dereference(net_device_ctx->nvdev);
struct nvsp_message *init_pkt = &nv_dev->channel_init_pkt; struct nvsp_message *init_pkt = &nv_dev->channel_init_pkt;
memset(init_pkt, 0, sizeof(struct nvsp_message)); memset(init_pkt, 0, sizeof(struct nvsp_message));
...@@ -549,7 +549,8 @@ void netvsc_device_remove(struct hv_device *device) ...@@ -549,7 +549,8 @@ void netvsc_device_remove(struct hv_device *device)
{ {
struct net_device *ndev = hv_get_drvdata(device); struct net_device *ndev = hv_get_drvdata(device);
struct net_device_context *net_device_ctx = netdev_priv(ndev); struct net_device_context *net_device_ctx = netdev_priv(ndev);
struct netvsc_device *net_device = net_device_ctx->nvdev; struct netvsc_device *net_device
= rtnl_dereference(net_device_ctx->nvdev);
int i; int i;
netvsc_disconnect_vsp(device); netvsc_disconnect_vsp(device);
......
...@@ -69,7 +69,7 @@ static void netvsc_set_multicast_list(struct net_device *net) ...@@ -69,7 +69,7 @@ static void netvsc_set_multicast_list(struct net_device *net)
static int netvsc_open(struct net_device *net) static int netvsc_open(struct net_device *net)
{ {
struct net_device_context *ndev_ctx = netdev_priv(net); struct net_device_context *ndev_ctx = netdev_priv(net);
struct netvsc_device *nvdev = ndev_ctx->nvdev; struct netvsc_device *nvdev = rtnl_dereference(ndev_ctx->nvdev);
struct rndis_device *rdev; struct rndis_device *rdev;
int ret = 0; int ret = 0;
...@@ -1364,7 +1364,7 @@ static struct net_device *get_netvsc_byref(struct net_device *vf_netdev) ...@@ -1364,7 +1364,7 @@ static struct net_device *get_netvsc_byref(struct net_device *vf_netdev)
continue; /* not a netvsc device */ continue; /* not a netvsc device */
net_device_ctx = netdev_priv(dev); net_device_ctx = netdev_priv(dev);
if (net_device_ctx->nvdev == NULL) if (!rtnl_dereference(net_device_ctx->nvdev))
continue; /* device is removed */ continue; /* device is removed */
if (rtnl_dereference(net_device_ctx->vf_netdev) == vf_netdev) if (rtnl_dereference(net_device_ctx->vf_netdev) == vf_netdev)
...@@ -1589,7 +1589,8 @@ static int netvsc_remove(struct hv_device *dev) ...@@ -1589,7 +1589,8 @@ static int netvsc_remove(struct hv_device *dev)
* removed. Also blocks mtu and channel changes. * removed. Also blocks mtu and channel changes.
*/ */
rtnl_lock(); rtnl_lock();
rndis_filter_device_remove(dev, ndev_ctx->nvdev); rndis_filter_device_remove(dev,
rtnl_dereference(ndev_ctx->nvdev));
rtnl_unlock(); rtnl_unlock();
unregister_netdev(net); unregister_netdev(net);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment