> diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index 4d3b3d60d893..a5412f14f57f 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -1073,6 +1073,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, > struct vmap_area *va, *pva; > unsigned long addr; > int purged = 0; > + int ret = -EBUSY; > > BUG_ON(!size); > BUG_ON(offset_in_page(size)); > @@ -1139,6 +1140,10 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, > va->va_end = addr + size; > va->vm = NULL; > > + ret = kasan_populate_vmalloc(addr, size); > + if (ret) > + goto out; > + But it introduces another issues when is CONFIG_KASAN_VMALLOC=y. If the kasan_populate_vmalloc() gets failed for some reason it just leaves the function, that will lead to waste of vmap space. > spin_lock(&vmap_area_lock); > insert_vmap_area(va, &vmap_area_root, &vmap_area_list); > spin_unlock(&vmap_area_lock); > ret = kasan_populate_vmalloc(addr, size); if (ret) { free_vmap_area(va); return ERR_PTR(-EBUSY);; } > @@ -1169,8 +1174,9 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, > pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n", > size); > > +out: > kmem_cache_free(vmap_area_cachep, va); > - return ERR_PTR(-EBUSY); > + return ERR_PTR(ret); > } >