提交 aa72fdb5 编写于 作者: S Sean Paul 提交者: Xie XiuQi

drm: Clear state->acquire_ctx before leaving drm_atomic_helper_commit_duplicated_state()

[ Upstream commit aa394b0dd68cb00c483e151dcd84713d4d517ed1 ]

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: NDaniel Vetter <daniel@ffwll.ch>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NSean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181129150423.239081-1-sean@poorly.runSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 c23f49cb
...@@ -3192,7 +3192,7 @@ EXPORT_SYMBOL(drm_atomic_helper_suspend); ...@@ -3192,7 +3192,7 @@ EXPORT_SYMBOL(drm_atomic_helper_suspend);
int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state,
struct drm_modeset_acquire_ctx *ctx) struct drm_modeset_acquire_ctx *ctx)
{ {
int i; int i, ret;
struct drm_plane *plane; struct drm_plane *plane;
struct drm_plane_state *new_plane_state; struct drm_plane_state *new_plane_state;
struct drm_connector *connector; struct drm_connector *connector;
...@@ -3211,7 +3211,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, ...@@ -3211,7 +3211,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) for_each_new_connector_in_state(state, connector, new_conn_state, i)
state->connectors[i].old_state = connector->state; 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); EXPORT_SYMBOL(drm_atomic_helper_commit_duplicated_state);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册