summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm
diff options
context:
space:
mode:
authorRoy Spliet <nouveau@spliet.org>2020-04-07 18:07:37 +0100
committerRob Clark <robdclark@chromium.org>2020-05-18 09:26:32 -0700
commite4337877c5d578722c0716f131fb774522013cf5 (patch)
tree6ba211861efc2284fb9ba5865eee3c8ef5652cb2 /drivers/gpu/drm/msm
parente4b397f6a54c1b653b65c3dbcf3d3a157f580355 (diff)
downloadlinux-e4337877c5d578722c0716f131fb774522013cf5.tar.bz2
drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation
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>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r--drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 47b989834af1..c23a2fa13fb9 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -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;
}