[PATCH 1/2] drm/vc4: Fix NULL pointer dereference in the async update path

Boris Brezillon boris.brezillon at bootlin.com
Tue Nov 13 22:18:17 UTC 2018


On Tue, 13 Nov 2018 13:24:07 -0800
Eric Anholt <eric at anholt.net> wrote:

> Boris Brezillon <boris.brezillon at bootlin.com> writes:
> 
> > vc4_plane_atomic_async_update() calls vc4_plane_atomic_check()
> > which in turn calls vc4_plane_setup_clipping_and_scaling(), and since
> > commit 58a6a36fe8e0 ("drm/vc4: Use
> > drm_atomic_helper_check_plane_state() to simplify the logic"), this
> > function accesses plane_state->state which will be NULL when called
> > from the async update path since we're passing previous plane state,
> > and plane_state->state has been assigned to NULL in
> > drm_atomic_helper_swap_state().
> >
> > Assign plane->state->state to new_plane_state->state before calling
> > vc4_plane_atomic_check() and reset it to NULL after
> > vc4_plane_atomic_check() as returned.
> >
> > Fixes: 58a6a36fe8e0 ("drm/vc4: Use drm_atomic_helper_check_plane_state() to simplify the logic")
> > Signed-off-by: Boris Brezillon <boris.brezillon at bootlin.com>  
> 
> Hmm.  Could we pass in the new state instead, and then pick the dlist
> items out of the new state's dlist to write into both our dlist copy and
> the hw dlist?

I considered doing that, but other fields in vc4_plane_state might be
updated too, and since we have to update things in place it was just
simpler to pass plane->state directly instead copying the updated
fields one by one (with the risk of missing one of them).



More information about the dri-devel mailing list