Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1df3a339 authored by Yue Hu's avatar Yue Hu Committed by Linus Torvalds
Browse files

mm/cma.c: fix crash on CMA allocation if bitmap allocation fails

f022d8cb ("mm: cma: Don't crash on allocation if CMA area can't be
activated") fixes the crash issue when activation fails via setting
cma->count as 0, same logic exists if bitmap allocation fails.

Link: http://lkml.kernel.org/r/20190325081309.6004-1-zbestahu@gmail.com


Signed-off-by: default avatarYue Hu <huyue2@yulong.com>
Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 113b7dfd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -106,8 +106,10 @@ static int __init cma_activate_area(struct cma *cma)

	cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL);

	if (!cma->bitmap)
	if (!cma->bitmap) {
		cma->count = 0;
		return -ENOMEM;
	}

	WARN_ON_ONCE(!pfn_valid(pfn));
	zone = page_zone(pfn_to_page(pfn));