summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-10-24 13:18:39 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-14 10:10:39 -0800
commit27a7bcd561d9c79bdd427f8855f130de88dce663 (patch)
treef73c3a46d4db7afb1782aa0ef17d5f4f25f17baf
parent37220fc8c02824734c6d9c59e0d0fd4e5abddb72 (diff)
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 <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>
-rw-r--r--mm/cma.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/cma.c b/mm/cma.c
index 0ab564623ea8..2904f45beab7 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;
}