Skip to content

Commit

Permalink
mm: cma: Don't crash on allocation if CMA area can't be activated
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Laurent Pinchart authored and mszyprow committed Oct 27, 2014
1 parent cac7f24 commit f022d8c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma)

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

Expand Down

0 comments on commit f022d8c

Please sign in to comment.