]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: Fix incorrect return of vblank enable on unconfigured crtc
authorIvan Lipski <ivan.lipski@amd.com>
Wed, 17 Sep 2025 15:00:02 +0000 (11:00 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:36:44 +0000 (15:36 -0500)
commit b3656b355b5522cef1b52a7469010009c98156db upstream.

[Why&How]
Return -EINVAL when userspace asks us to enable vblank on a crtc that is
not yet enabled.

Suggested-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/1856
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit cb57b8cdb072dc37723b6906da1c37ff9cbc2da4)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c

index 45feb404b0979e498e0b8193b957bc54074621e1..80205c9bc940307539e8d1302c43f5078fcff34d 100644 (file)
@@ -293,8 +293,12 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)
        int irq_type;
        int rc = 0;
 
-       if (acrtc->otg_inst == -1)
-               goto skip;
+       if (enable && !acrtc->base.enabled) {
+               drm_dbg_vbl(crtc->dev,
+                               "Reject vblank enable on unconfigured CRTC %d (enabled=%d)\n",
+                               acrtc->crtc_id, acrtc->base.enabled);
+               return -EINVAL;
+       }
 
        irq_type = amdgpu_display_crtc_idx_to_irq_type(adev, acrtc->crtc_id);
 
@@ -375,7 +379,7 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)
                        return rc;
        }
 #endif
-skip:
+
        if (amdgpu_in_reset(adev))
                return 0;