Skip to content

Commit f022d8c

Browse files
Laurent Pinchartmszyprow
authored andcommitted
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: <[email protected]> # v3.17 Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Michal Nazarewicz <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]>
1 parent cac7f24 commit f022d8c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

mm/cma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma)
124124

125125
err:
126126
kfree(cma->bitmap);
127+
cma->count = 0;
127128
return -EINVAL;
128129
}
129130

0 commit comments

Comments
 (0)