X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fpalacios-vnet-ctrl.c;h=f8043b7bfe40e6a1f6fbcfc3c1088bd73e9f3f7c;hb=b7093fd3602ef2c796a1f8a0daded9d6aad0b756;hp=992556c332a7654828ca65c05569235375832b1b;hpb=791ea2f3e21cfbc9c47341efbb98995c33d86fcb;p=palacios.git diff --git a/linux_module/palacios-vnet-ctrl.c b/linux_module/palacios-vnet-ctrl.c index 992556c..f8043b7 100644 --- a/linux_module/palacios-vnet-ctrl.c +++ b/linux_module/palacios-vnet-ctrl.c @@ -544,7 +544,7 @@ static void delete_route(struct vnet_route_iter * route) { INFO("VNET Control: Route %d deleted from VNET\n", route->idx); - kfree(route); + palacios_free(route); route = NULL; } @@ -593,21 +593,24 @@ route_write(struct file * file, if (strnicmp("ADD", token, strlen("ADD")) == 0) { struct vnet_route_iter * new_route = NULL; - new_route = kmalloc(sizeof(struct vnet_route_iter), GFP_KERNEL); + new_route = palacios_alloc(sizeof(struct vnet_route_iter)); if (!new_route) { + ERROR("Cannot allocate new route\n"); return -ENOMEM; } memset(new_route, 0, sizeof(struct vnet_route_iter)); if (parse_route_str(buf_iter, &(new_route->route)) == -1) { - kfree(new_route); + ERROR("Cannot parse new route\n"); + palacios_free(new_route); return -EFAULT; } if (inject_route(new_route) != 0) { - kfree(new_route); + ERROR("Cannot inject new route\n"); + palacios_free(new_route); return -EFAULT; } } else if (strnicmp("DEL", token, strlen("DEL")) == 0) { @@ -651,7 +654,7 @@ static void delete_link(struct vnet_link_iter * link){ vnet_ctrl_s.num_links --; spin_unlock_irqrestore(&(vnet_ctrl_s.lock), flags); - kfree(link); + palacios_free(link); link = NULL; } @@ -728,7 +731,12 @@ link_write(struct file * file, const char * buf, size_t size, loff_t * ppos) { return -EFAULT; } - link = kmalloc(sizeof(struct vnet_link_iter), GFP_KERNEL); + link = palacios_alloc(sizeof(struct vnet_link_iter)); + if (!link) { + WARNING("VNET Control: Cannot allocate link\n"); + return -EFAULT; + } + memset(link, 0, sizeof(struct vnet_link_iter)); link->dst_ip = d_ip; @@ -877,7 +885,9 @@ static int init_proc_files(void) { struct proc_dir_entry * debug_entry = NULL; struct proc_dir_entry * vnet_root = NULL; - vnet_root = proc_mkdir("vnet", NULL); + + vnet_root = proc_mkdir("vnet", palacios_get_procdir()); + if (vnet_root == NULL) { return -1; } @@ -957,12 +967,17 @@ int vnet_ctrl_init(void) { void vnet_ctrl_deinit(void){ + + INFO("VNET Control Deinit Started\n"); + destroy_proc_files(); deinit_links_list(); deinit_routes_list(); vnet_ctrl_s.status = 0; + + INFO("VNET Control Deinit Finished\n"); }