Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Lots of pedantic error checking in Palacios proper, especially for memory
[palacios.git] / linux_module / palacios-vnet-ctrl.c
index 992556c..f8043b7 100644 (file)
@@ -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");
 }