summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHaiyang Zhang <haiyangz@microsoft.com>2017-08-24 20:50:02 +0200
committerDavid S. Miller <davem@davemloft.net>2017-08-25 06:55:59 +0200
commitc6f71c418fcc46f59fc87ac93ce9336c12d7898b (patch)
treed09989595a0062aaeb484060ab6d7a1af3ba99ff /drivers
parentMerge tag 'mlx5-updates-2017-08-24' of git://git.kernel.org/pub/scm/linux/ker... (diff)
downloadlinux-c6f71c418fcc46f59fc87ac93ce9336c12d7898b.tar.xz
linux-c6f71c418fcc46f59fc87ac93ce9336c12d7898b.zip
hv_netvsc: Fix rndis_filter_close error during netvsc_remove
We now remove rndis filter before unregister_netdev(), which calls device close. It involves closing rndis filter already removed. This patch fixes this error. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/hyperv/netvsc_drv.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index c0c4c9195a3f..fac44c5c8d0d 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -119,12 +119,16 @@ static int netvsc_close(struct net_device *net)
struct net_device *vf_netdev
= rtnl_dereference(net_device_ctx->vf_netdev);
struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
- int ret;
+ int ret = 0;
u32 aread, i, msec = 10, retry = 0, retry_max = 20;
struct vmbus_channel *chn;
netif_tx_disable(net);
+ /* No need to close rndis filter if it is removed already */
+ if (!nvdev)
+ goto out;
+
ret = rndis_filter_close(nvdev);
if (ret != 0) {
netdev_err(net, "unable to close device (ret %d).\n", ret);
@@ -163,6 +167,7 @@ static int netvsc_close(struct net_device *net)
ret = -ETIMEDOUT;
}
+out:
if (vf_netdev)
dev_close(vf_netdev);