|
@@ -42,6 +42,12 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
|
|
if (!net_device)
|
|
if (!net_device)
|
|
return NULL;
|
|
return NULL;
|
|
|
|
|
|
|
|
+ net_device->cb_buffer = kzalloc(NETVSC_PACKET_SIZE, GFP_KERNEL);
|
|
|
|
+ if (!net_device->cb_buffer) {
|
|
|
|
+ kfree(net_device);
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
init_waitqueue_head(&net_device->wait_drain);
|
|
init_waitqueue_head(&net_device->wait_drain);
|
|
net_device->start_remove = false;
|
|
net_device->start_remove = false;
|
|
net_device->destroy = false;
|
|
net_device->destroy = false;
|
|
@@ -52,6 +58,12 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
|
|
return net_device;
|
|
return net_device;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void free_netvsc_device(struct netvsc_device *nvdev)
|
|
|
|
+{
|
|
|
|
+ kfree(nvdev->cb_buffer);
|
|
|
|
+ kfree(nvdev);
|
|
|
|
+}
|
|
|
|
+
|
|
static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
|
|
static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
|
|
{
|
|
{
|
|
struct netvsc_device *net_device;
|
|
struct netvsc_device *net_device;
|
|
@@ -551,7 +563,7 @@ int netvsc_device_remove(struct hv_device *device)
|
|
if (net_device->sub_cb_buf)
|
|
if (net_device->sub_cb_buf)
|
|
vfree(net_device->sub_cb_buf);
|
|
vfree(net_device->sub_cb_buf);
|
|
|
|
|
|
- kfree(net_device);
|
|
|
|
|
|
+ free_netvsc_device(net_device);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1093,7 +1105,7 @@ close:
|
|
vmbus_close(device->channel);
|
|
vmbus_close(device->channel);
|
|
|
|
|
|
cleanup:
|
|
cleanup:
|
|
- kfree(net_device);
|
|
|
|
|
|
+ free_netvsc_device(net_device);
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|