dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Eric Anholt <eric@anholt.net>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/vc4: Fix NULL pointer dereference in the async update path
Date: Tue, 13 Nov 2018 23:18:17 +0100	[thread overview]
Message-ID: <20181113231817.6fe559fb@bbrezillon> (raw)
In-Reply-To: <87r2follhk.fsf@anholt.net>

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

> Boris Brezillon <boris.brezillon@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@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).

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2018-11-13 22:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13  9:49 [PATCH 1/2] drm/vc4: Fix NULL pointer dereference in the async update path Boris Brezillon
2018-11-13  9:49 ` [PATCH 2/2] drm/vc4: Set ->legacy_cursor_update to false when doing non-async updates Boris Brezillon
2018-11-13 21:18   ` Eric Anholt
2018-11-13 21:24 ` [PATCH 1/2] drm/vc4: Fix NULL pointer dereference in the async update path Eric Anholt
2018-11-13 22:18   ` Boris Brezillon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181113231817.6fe559fb@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox