aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2016-06-14 13:50:58 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-06-15 11:14:24 -0400
commit723c3e553051bcb82eb8d8962c04171040068e83 (patch)
treea89748a0f1a1940701d22e439e7a444ff8f2c409
parent0e7c875d1ae9dcf4d8c6018a45e5529feaef8956 (diff)
drm/atomic-helpers: Stall on the right commit
stall_checks carefully picked out the right commit to stall on, then promptly used the wrong variable. Due to the break in the next loop iteration this could be the 3rd commit, or if the list only has 2 entries commit would now point into the struct drm_crtc itself, at some offset. Hilarity eventually ensues. For added safety, also break right away instead of iterating once more, but the real fix is waiting on stall_commit instead of commit. Reported-and-tested-by: Liviu Dudau <Liviu.Dudau@arm.com> Cc: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1465926658-10110-1-git-send-email-daniel.vetter@ffwll.ch
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 6a13df8691d4..716aa535eb98 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1324,8 +1324,8 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock)
1324 } else if (i == 1) { 1324 } else if (i == 1) {
1325 stall_commit = commit; 1325 stall_commit = commit;
1326 drm_crtc_commit_get(stall_commit); 1326 drm_crtc_commit_get(stall_commit);
1327 } else
1328 break; 1327 break;
1328 }
1329 1329
1330 i++; 1330 i++;
1331 } 1331 }
@@ -1337,7 +1337,7 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock)
1337 /* We don't want to let commits get ahead of cleanup work too much, 1337 /* We don't want to let commits get ahead of cleanup work too much,
1338 * stalling on 2nd previous commit means triple-buffer won't ever stall. 1338 * stalling on 2nd previous commit means triple-buffer won't ever stall.
1339 */ 1339 */
1340 ret = wait_for_completion_interruptible_timeout(&commit->cleanup_done, 1340 ret = wait_for_completion_interruptible_timeout(&stall_commit->cleanup_done,
1341 10*HZ); 1341 10*HZ);
1342 if (ret == 0) 1342 if (ret == 0)
1343 DRM_ERROR("[CRTC:%d:%s] cleanup_done timed out\n", 1343 DRM_ERROR("[CRTC:%d:%s] cleanup_done timed out\n",