Skip to content

Commit

Permalink
netvsc: fix error unwind on device setup failure
Browse files Browse the repository at this point in the history
If setting receive buffer fails, the error unwind would cause
kernel panic because it was not correctly doing RCU and NAPI
unwind.  RCU'd pointer needs to be reset to NULL, and NAPI needs
to be disabled not deleted.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
shemminger authored and davem330 committed Jul 29, 2017
1 parent 7426b1a commit 4939334
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/hyperv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,8 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,
return net_device;

close:
netif_napi_del(&net_device->chan_table[0].napi);
RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
napi_disable(&net_device->chan_table[0].napi);

/* Now, we can close the channel safely */
vmbus_close(device->channel);
Expand Down

0 comments on commit 4939334

Please sign in to comment.