mm: cma: Don't crash on allocation if CMA area can't be activated
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 24 Oct 2014 10:18:39 +0000 (13:18 +0300)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 27 Oct 2014 12:00:54 +0000 (13:00 +0100)
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: <stable@vger.kernel.org> # v3.17
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
mm/cma.c

index 963bc4add9af88838b494e6dd56b2bf2239548a2..5aa1a6f74decadbb285ce4d12a74d7465259c369 100644 (file)
--- 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;
 }
 
This page took 0.026026 seconds and 5 git commands to generate.