]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: Fix potential integer wraparound resulting in a hang
authorAric Cyr <aric.cyr@amd.com>
Tue, 12 May 2020 15:48:48 +0000 (11:48 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 27 May 2020 22:13:14 +0000 (18:13 -0400)
[Why]
If VUPDATE_END is before VUPDATE_START the delay calculated can become
very large, causing a soft hang.

[How]
Take the absolute value of the difference between START and END.

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

index 82fc3d5b3b2a2749d4a11167cd7bc174b3e098bd..416afb99529d1864031c7d9c5d809aaf2e8c776d 100644 (file)
@@ -1684,6 +1684,8 @@ static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx)
                return;
 
        /* Stall out until the cursor update completes. */
+       if (vupdate_end < vupdate_start)
+               vupdate_end += stream->timing.v_total;
        us_vupdate = (vupdate_end - vupdate_start + 1) * us_per_line;
        udelay(us_to_vupdate + us_vupdate);
 }