From 27a7bcd561d9c79bdd427f8855f130de88dce663 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 24 Oct 2014 13:18:39 +0300 Subject: [PATCH] mm: cma: Don't crash on allocation if CMA area can't be activated commit f022d8cb7ec70fe8edd56383d876001317ee76b1 upstream. 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. Signed-off-by: Laurent Pinchart Acked-by: Michal Nazarewicz Signed-off-by: Marek Szyprowski Signed-off-by: Greg Kroah-Hartman --- mm/cma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/cma.c b/mm/cma.c index 0ab564623ea84..2904f45beab7c 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -123,6 +123,7 @@ static int __init cma_activate_area(struct cma *cma) err: kfree(cma->bitmap); + cma->count = 0; return -EINVAL; } -- 2.47.2