From: Laurent Pinchart Date: Fri, 24 Oct 2014 10:18:39 +0000 (+0300) Subject: mm: cma: Don't crash on allocation if CMA area can't be activated X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f022d8cb7ec7;p=linux.git mm: cma: Don't crash on allocation if CMA area can't be activated 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: # v3.17 Signed-off-by: Laurent Pinchart Acked-by: Michal Nazarewicz Signed-off-by: Marek Szyprowski --- diff --git a/mm/cma.c b/mm/cma.c index 963bc4add9af8..5aa1a6f74deca 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; }