Skip to content

Commit 947a844

Browse files
HBh25Yrobclark
authored andcommitted
drm: msm: fix possible memory leak in mdp5_crtc_cursor_set()
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>
1 parent cec4e5c commit 947a844

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,10 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc,
997997

998998
ret = msm_gem_get_and_pin_iova(cursor_bo, kms->aspace,
999999
&mdp5_crtc->cursor.iova);
1000-
if (ret)
1000+
if (ret) {
1001+
drm_gem_object_put(cursor_bo);
10011002
return -EINVAL;
1003+
}
10021004

10031005
pm_runtime_get_sync(&pdev->dev);
10041006

0 commit comments

Comments
 (0)