Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma)

err:
	kfree(cma->bitmap);
	cma->count = 0;
	return -EINVAL;
}