hv_netvsc: fix error unwind handling if vmbus_open fails
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 14 May 2018 22:32:11 +0000 (15:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:17:28 +0000 (16:17 +0200)
[ Commit fcfb4a00d1e514e8313277a01ef919de1113025b upstream. ]

Need to delete NAPI association if vmbus_open fails.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/hyperv/netvsc.c

index 839b9d6ecb41e24154a984d9e30ff9fcb5e253b0..b7720b65f5d60279a79f6cdc0107b07573ab85a4 100644 (file)
@@ -1288,7 +1288,6 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,
                         net_device->chan_table);
 
        if (ret != 0) {
-               netif_napi_del(&net_device->chan_table[0].napi);
                netdev_err(ndev, "unable to open channel: %d\n", ret);
                goto cleanup;
        }
@@ -1321,6 +1320,7 @@ close:
        vmbus_close(device->channel);
 
 cleanup:
+       netif_napi_del(&net_device->chan_table[0].napi);
        free_netvsc_device(&net_device->rcu);
 
        return ERR_PTR(ret);