Merge branch 'hv_netvsc-fix-error-handling-in-netvsc_attach-set_features'

Haiyang Zhang says:

====================
hv_netvsc: fix error handling in netvsc_attach/set_features

The error handling code path in these functions are not correct.
This patch set fixes them.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2019-10-30 18:17:36 -07:00
commit 3da0966320

View File

@ -982,7 +982,7 @@ static int netvsc_attach(struct net_device *ndev,
if (netif_running(ndev)) { if (netif_running(ndev)) {
ret = rndis_filter_open(nvdev); ret = rndis_filter_open(nvdev);
if (ret) if (ret)
return ret; goto err;
rdev = nvdev->extension; rdev = nvdev->extension;
if (!rdev->link_state) if (!rdev->link_state)
@ -990,6 +990,13 @@ static int netvsc_attach(struct net_device *ndev,
} }
return 0; return 0;
err:
netif_device_detach(ndev);
rndis_filter_device_remove(hdev, nvdev);
return ret;
} }
static int netvsc_set_channels(struct net_device *net, static int netvsc_set_channels(struct net_device *net,
@ -1807,8 +1814,10 @@ static int netvsc_set_features(struct net_device *ndev,
ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads); ret = rndis_filter_set_offload_params(ndev, nvdev, &offloads);
if (ret) if (ret) {
features ^= NETIF_F_LRO; features ^= NETIF_F_LRO;
ndev->features = features;
}
syncvf: syncvf:
if (!vf_netdev) if (!vf_netdev)