Commit f022d8cb authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Marek Szyprowski

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: <stable@vger.kernel.org>  # v3.17
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
parent cac7f242
...@@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma) ...@@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma)
err: err:
kfree(cma->bitmap); kfree(cma->bitmap);
cma->count = 0;
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment