Skip to content

Commit

Permalink
drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation
Browse files Browse the repository at this point in the history
When allocation for mdp5_kms fails, calling mdp5_destroy() leads to undefined
behaviour, likely a nullptr exception or use-after-free troubles.

Signed-off-by: Roy Spliet <nouveau@spliet.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
  • Loading branch information
Roy Spliet authored and Rob Clark committed May 18, 2020
1 parent e4b397f commit e433787
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,8 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)

return 0;
fail:
mdp5_destroy(pdev);
if (mdp5_kms)
mdp5_destroy(pdev);
return ret;
}

Expand Down

0 comments on commit e433787

Please sign in to comment.