summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <sthemmin@microsoft.com>2016-09-22 16:56:30 -0700
committerDavid S. Miller <davem@davemloft.net>2016-09-23 08:39:48 -0400
commit07d0f0008c783d2a2fce8497000938db15fd7aa1 (patch)
treeb792016c8e949a41850a188a6eadebb9250f74eb /drivers
parent17db4bcef3c3c45b95b3b3d8577f725df1b2c0a0 (diff)
downloadblackbird-op-linux-07d0f0008c783d2a2fce8497000938db15fd7aa1.tar.gz
blackbird-op-linux-07d0f0008c783d2a2fce8497000938db15fd7aa1.zip
hv_netvsc: dev hold/put reference to VF
The netvsc driver holds a pointer to the virtual function network device if managing SR-IOV association. In order to ensure that the VF network device does not disappear, it should be using dev_hold/dev_put to get a reference count. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/hyperv/netvsc_drv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 2360e704e271..e74dbcc2916d 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1262,6 +1262,8 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
* Take a reference on the module.
*/
try_module_get(THIS_MODULE);
+
+ dev_hold(vf_netdev);
net_device_ctx->vf_netdev = vf_netdev;
return NOTIFY_OK;
}
@@ -1376,6 +1378,7 @@ static int netvsc_unregister_vf(struct net_device *vf_netdev)
netdev_info(ndev, "VF unregistering: %s\n", vf_netdev->name);
netvsc_inject_disable(net_device_ctx);
net_device_ctx->vf_netdev = NULL;
+ dev_put(vf_netdev);
module_put(THIS_MODULE);
return NOTIFY_OK;
}
OpenPOWER on IntegriCloud