Skip to content
  • Jeremy Fitzhardinge's avatar
    i386: fix iounmap's use of vm_struct's size field · 9585116b
    Jeremy Fitzhardinge authored
    
    
    get_vm_area always returns an area with an adjacent guard page.  That guard
    page is included in vm_struct.size.  iounmap uses vm_struct.size to
    determine how much address space needs to have change_page_attr applied to
    it, which will BUG if applied to the guard page.
    
    This patch adds a helper function - get_vm_area_size() in linux/vmalloc.h -
    to return the actual size of a vm area, and uses it to make iounmap do the
    right thing.  There are probably other places which should be using
    get_vm_area_size().
    
    Thanks to Dave Young <hidave.darkstar@gmail.com> for debugging the
    problem.
    
    [ Andi, it wasn't clear to me whether x86_64 needs the same fix. ]
    
    Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
    Cc: Dave Young <hidave.darkstar@gmail.com>
    Cc: Chuck Ebbert <cebbert@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarAndi Kleen <ak@suse.de>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    9585116b