linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/cma: Fix crash on CMA allocation if bitmap allocation fails
@ 2019-03-25  8:13 Yue Hu
  2019-03-25 10:14 ` Anshuman Khandual
  2019-03-25 22:15 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Yue Hu @ 2019-03-25  8:13 UTC (permalink / raw)
  To: akpm, iamjoonsoo.kim, labbott, rppt, rdunlap; +Cc: linux-mm, huyue2

From: Yue Hu <huyue2@yulong.com>

A previous commit 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.

Signed-off-by: Yue Hu <huyue2@yulong.com>
---
 mm/cma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/cma.c b/mm/cma.c
index f5bf819..991a6ce 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -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));
-- 
1.9.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-26  1:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25  8:13 [PATCH] mm/cma: Fix crash on CMA allocation if bitmap allocation fails Yue Hu
2019-03-25 10:14 ` Anshuman Khandual
2019-03-25 22:15 ` Andrew Morton
2019-03-26  1:59   ` Yue Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox