]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - mm/vmalloc.c
vmalloc: unmap vmalloc area after hiding it
[net-next-2.6.git] / mm / vmalloc.c
index 759deae4539a531824eb2986f5deed474a8436a6..c4071fa8e12a6b72628a5bb3a0d33ba2e2febce9 100644 (file)
@@ -1270,17 +1270,21 @@ struct vm_struct *remove_vm_area(const void *addr)
        if (va && va->flags & VM_VM_AREA) {
                struct vm_struct *vm = va->private;
                struct vm_struct *tmp, **p;
-
-               vmap_debug_free_range(va->va_start, va->va_end);
-               free_unmap_vmap_area(va);
-               vm->size -= PAGE_SIZE;
-
+               /*
+                * remove from list and disallow access to this vm_struct
+                * before unmap. (address range confliction is maintained by
+                * vmap.)
+                */
                write_lock(&vmlist_lock);
                for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
                        ;
                *p = tmp->next;
                write_unlock(&vmlist_lock);
 
+               vmap_debug_free_range(va->va_start, va->va_end);
+               free_unmap_vmap_area(va);
+               vm->size -= PAGE_SIZE;
+
                return vm;
        }
        return NULL;