Commit f3da1dc8 authored by Yue Hu's avatar Yue Hu Committed by Greg Kroah-Hartman

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

[ Upstream commit 1df3a339074e31db95c4790ea9236874b13ccd87 ]

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: default avatarYue Hu <>
Reviewed-by: default avatarAnshuman Khandual <>
Cc: Joonsoo Kim <>
Cc: Laura Abbott <>
Cc: Mike Rapoport <>
Cc: Randy Dunlap <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
Signed-off-by: default avatarSasha Levin <>
parent 27d8fa82
......@@ -105,8 +105,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;
zone = page_zone(pfn_to_page(pfn));
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment