mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
mm/large system hash: avoid possible NULL deref in alloc_large_system_hash
If __vmalloc() returned NULL, is_vm_area_hugepages(NULL) will fault if
CONFIG_HAVE_ARCH_HUGE_VMALLOC=y
Link: https://lkml.kernel.org/r/20210915212530.2321545-1-eric.dumazet@gmail.com
Fixes: 121e6f3258
("mm/vmalloc: hugepage vmalloc mappings")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
34b46efd6e
commit
084f7e2377
1 changed files with 2 additions and 1 deletions
|
@ -8762,7 +8762,8 @@ void *__init alloc_large_system_hash(const char *tablename,
|
|||
} else if (get_order(size) >= MAX_ORDER || hashdist) {
|
||||
table = __vmalloc(size, gfp_flags);
|
||||
virt = true;
|
||||
huge = is_vm_area_hugepages(table);
|
||||
if (table)
|
||||
huge = is_vm_area_hugepages(table);
|
||||
} else {
|
||||
/*
|
||||
* If bucketsize is not a power-of-two, we may free
|
||||
|
|
Loading…
Reference in a new issue