Skip to content

Commit

Permalink
drm: msm: fix possible memory leak in mdp5_crtc_cursor_set()
Browse files Browse the repository at this point in the history
[ Upstream commit 947a844 ]

drm_gem_object_lookup will call drm_gem_object_get inside. So cursor_bo
needs to be put when msm_gem_get_and_pin_iova fails.

Fixes: e172d10 ("drm/msm/mdp5: Add hardware cursor support")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20220509061125.18585-1-hbh25y@gmail.com
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
HBh25Y authored and gregkh committed Jun 9, 2022
1 parent 48e82ce commit 656aa3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,8 +983,10 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc,

ret = msm_gem_get_and_pin_iova(cursor_bo, kms->aspace,
&mdp5_crtc->cursor.iova);
if (ret)
if (ret) {
drm_gem_object_put(cursor_bo);
return -EINVAL;
}

pm_runtime_get_sync(&pdev->dev);

Expand Down

0 comments on commit 656aa3c

Please sign in to comment.