diff options
author | Hangyu Hua <hbh25y@gmail.com> | 2022-05-09 09:11:25 +0300 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2022-05-18 21:05:21 +0300 |
commit | 947a844bb3ebff0f4736d244d792ce129f6700d7 (patch) | |
tree | f43bd56802ff8b3347e8d0d152d1825d24ebd7eb /drivers/gpu | |
parent | cec4e5cbb91bf3d6e238e4983398ba443b6ffdfa (diff) | |
download | linux-947a844bb3ebff0f4736d244d792ce129f6700d7.tar.xz |
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: e172d10a9c4a ("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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index fe2922c8d21b..31447da0af25 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -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); |