Skip to content

Commit

Permalink
drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit…
Browse files Browse the repository at this point in the history
…_duplicated_state()

drm_atomic_helper_commit_duplicated_state() sets state->acquire_ctx to
the context given in the argument and leaves it in state after it
quits. The lifetime of state and context are not guaranteed to be the
same, so we shouldn't leave that pointer hanging around. This patch
resets the context to NULL to avoid any oopses.

Changes in v2:
- Added to the set

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-1-sean@poorly.run
  • Loading branch information
Sean Paul committed Nov 29, 2018
1 parent 2f690fa commit aa394b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpu/drm/drm_atomic_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -3229,7 +3229,7 @@ EXPORT_SYMBOL(drm_atomic_helper_suspend);
int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
struct drm_modeset_acquire_ctx *ctx)
{
int i;
int i, ret;
struct drm_plane *plane;
struct drm_plane_state *new_plane_state;
struct drm_connector *connector;
Expand All @@ -3248,7 +3248,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
for_each_new_connector_in_state(state, connector, new_conn_state, i)
state->connectors[i].old_state = connector->state;

return drm_atomic_commit(state);
ret = drm_atomic_commit(state);

state->acquire_ctx = NULL;

return ret;
}
EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);

Expand Down

0 comments on commit aa394b0

Please sign in to comment.