Thread (9 messages) 9 messages, 5 authors, 2014-10-27
STALE4273d REVIEWED: 1 (0M)
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 1/4] mm: cma: Don't crash on allocation if CMA area can't be activated

From: laurent.pinchart+renesas@ideasonboard.com (Laurent Pinchart)
Date: 2014-10-24 10:18:50
Also in: linux-mm, linux-sh, lkml
Subsystem: memory management, memory management - misc, the rest · Maintainers: Andrew Morton, David Hildenbrand, Linus Torvalds

If activation of the CMA area fails its mutex won't be initialized,
leading to an oops at allocation time when trying to lock the mutex. Fix
this by setting the cma area count field to 0 when activation fails,
leading to allocation returning NULL immediately.

Cc: <redacted>  # v3.17
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Michal Nazarewicz <redacted>
---
 mm/cma.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/mm/cma.c b/mm/cma.c
index 963bc4add9af..5aa1a6f74dec 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma)
 
 err:
 	kfree(cma->bitmap);
+	cma->count = 0;
 	return -EINVAL;
 }
 
-- 
2.0.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help