drm/vc4: kms: Wait on previous FIFO users before a commit
authorMaxime Ripard <maxime@cerno.tech>
Fri, 4 Dec 2020 15:11:35 +0000 (16:11 +0100)
committerMaxime Ripard <maxime@cerno.tech>
Tue, 15 Dec 2020 10:33:34 +0000 (11:33 +0100)
commit9ec03d7f1ed394897891319a4dda75f52c5d292d
treec8c75ac2997c392219ba65a28a3b3e9c55953763
parentd62a8ed7671ee1deaabe339df3703f8dff56183b
drm/vc4: kms: Wait on previous FIFO users before a commit

If we're having two subsequent, non-blocking, commits on two different
CRTCs that share no resources, there's no guarantee on the order of
execution of both commits.

However, the second one will consider the first one as the old state,
and will be in charge of freeing it once that second commit is done.

If the first commit happens after that second commit, it might access
some resources related to its state that has been freed, resulting in a
use-after-free bug.

The standard DRM objects are protected against this, but our HVS private
state isn't so let's make sure we wait for all the previous FIFO users
to finish their commit before going with our own.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201204151138.1739736-5-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_kms.c