Skip to content

Commit

Permalink
mm/large system hash: avoid possible NULL deref in alloc_large_system…
Browse files Browse the repository at this point in the history
…_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/[email protected]
Fixes: 121e6f3 ("mm/vmalloc: hugepage vmalloc mappings")
Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Eric Dumazet authored and torvalds committed Nov 6, 2021
1 parent 34b46ef commit 084f7e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 084f7e2

Please sign in to comment.