aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChintan Pandya <[email protected]>2018-06-07 17:06:53 -0700
committerLinus Torvalds <[email protected]>2018-06-07 17:34:35 -0700
commit05e3ff9505858a39dc696ca195b5d79e524aac03 (patch)
treecf70546db807b048229b4f1e9bc06ac127f85dc3
parentf3c01d2f3ade6790db67f80fef60df84424f8964 (diff)
mm: vmalloc: pass proper vm_start into debugobjects
Client can call vunmap with some intermediate 'addr' which may not be the start of the VM area. Entire unmap code works with vm->vm_start which is proper but debug object API is called with 'addr'. This could be a problem within debug objects. Pass proper start address into debug object API. [[email protected]: fix warning] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Chintan Pandya <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Byungchul Park <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Laura Abbott <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Wei Yang <[email protected]> Cc: Yisheng Xie <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/vmalloc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4df66e1abeb1..89efac3a020e 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1128,15 +1128,16 @@ void vm_unmap_ram(const void *mem, unsigned int count)
BUG_ON(addr > VMALLOC_END);
BUG_ON(!PAGE_ALIGNED(addr));
- debug_check_no_locks_freed(mem, size);
-
if (likely(count <= VMAP_MAX_ALLOC)) {
+ debug_check_no_locks_freed(mem, size);
vb_free(mem, size);
return;
}
va = find_vmap_area(addr);
BUG_ON(!va);
+ debug_check_no_locks_freed((void *)va->va_start,
+ (va->va_end - va->va_start));
free_unmap_vmap_area(va);
}
EXPORT_SYMBOL(vm_unmap_ram);
@@ -1511,8 +1512,8 @@ static void __vunmap(const void *addr, int deallocate_pages)
return;
}
- debug_check_no_locks_freed(addr, get_vm_area_size(area));
- debug_check_no_obj_freed(addr, get_vm_area_size(area));
+ debug_check_no_locks_freed(area->addr, get_vm_area_size(area));
+ debug_check_no_obj_freed(area->addr, get_vm_area_size(area));
remove_vm_area(addr);
if (deallocate_pages) {