]> git.hungrycats.org Git - linux/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 18:10:39 +0000 (10:10 -0800)
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 <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/cma.c

index 0ab564623ea843fe597d4f2f547a90b412c9aa5b..2904f45beab7c85159461b448e48a037440bb478 100644 (file)
--- 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;
 }