Commit 947a844b authored by Hangyu Hua's avatar Hangyu Hua Committed by Rob Clark

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: e172d10a ("drm/msm/mdp5: Add hardware cursor support")
Signed-off-by: default avatarHangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20220509061125.18585-1-hbh25y@gmail.comSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent cec4e5cb
......@@ -997,8 +997,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment