lkml.org 
[lkml]   [2009]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[BUGFIX][PATCH 1/3] unmap vmalloc area after hide it
    This is necessary to garantee sane access of vread/vwrite.

    ==
    From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

    vmap area should be purged after vm_struct is removed from the list
    because vread/vwrite etc...believes the range is valid while it's on
    vm_struct list.

    Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
    Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    ---
    mm/vmalloc.c | 14 +++++++++-----
    1 file changed, 9 insertions(+), 5 deletions(-)

    Index: linux-2.6.31-rc4/mm/vmalloc.c
    ===================================================================
    --- linux-2.6.31-rc4.orig/mm/vmalloc.c 2009-07-31 15:51:56.000000000 +0900
    +++ linux-2.6.31-rc4/mm/vmalloc.c 2009-07-31 15:52:42.000000000 +0900
    @@ -1256,17 +1256,21 @@
    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;


    \
     
     \ /
      Last update: 2009-08-03 13:21    [W:4.069 / U:0.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site