The patch titled Subject: mm/cma.c: fix crash on CMA allocation if bitmap allocation fails has been added to the -mm tree. Its filename is mm-cma-fix-crash-on-cma-allocation-if-bitmap-allocation-fails.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-cma-fix-crash-on-cma-allocation-if-bitmap-allocation-fails.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-cma-fix-crash-on-cma-allocation-if-bitmap-allocation-fails.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yue Hu <huyue2@xxxxxxxxxx> Subject: mm/cma.c: fix crash on CMA allocation if bitmap allocation fails f022d8cb7ec7 ("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@xxxxxxxxx Signed-off-by: Yue Hu <huyue2@xxxxxxxxxx> Reviewed-by: Anshuman Khandual <anshuman.khandual@xxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Laura Abbott <labbott@xxxxxxxxxx> Cc: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/cma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/cma.c~mm-cma-fix-crash-on-cma-allocation-if-bitmap-allocation-fails +++ a/mm/cma.c @@ -106,8 +106,10 @@ static int __init cma_activate_area(stru 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)); _ Patches currently in -mm which might be from huyue2@xxxxxxxxxx are mm-cma_debugc-fix-the-break-condition-in-cma_maxchunk_get.patch mm-cma-fix-the-bitmap-status-to-show-failed-allocation-reason.patch mm-cma-fix-crash-on-cma-allocation-if-bitmap-allocation-fails.patch