Skip to content

Commit d134c5f

Browse files
committed
drm/vc4: kms: Clear the HVS FIFO commit pointer once done
Commit 9ec03d7 ("drm/vc4: kms: Wait on previous FIFO users before a commit") introduced a wait on the previous commit done on a given HVS FIFO. However, we never cleared that pointer once done. Since drm_crtc_commit_put can free the drm_crtc_commit structure directly if we were the last user, this means that it can lead to a use-after free if we were to duplicate the state, and that stale pointer would even be copied to the new state. Set the pointer to NULL once we're done with the wait so that we don't carry over a pointer to a free'd structure. Fixes: 9ec03d7 ("drm/vc4: kms: Wait on previous FIFO users before a commit") Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Tested-by: Jian-Hong Pan <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 049cfff commit d134c5f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpu/drm/vc4/vc4_kms.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
379379
drm_err(dev, "Timed out waiting for commit\n");
380380

381381
drm_crtc_commit_put(commit);
382+
old_hvs_state->fifo_state[channel].pending_commit = NULL;
382383
}
383384

384385
if (vc4->hvs->hvs5)

0 commit comments

Comments
 (0)