diff options
author | Andrey Grodzovsky <andrey.grodzovsky@amd.com> | 2018-12-06 15:51:37 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-12-11 11:16:14 -0500 |
commit | c554206077428af56cc2e0314b86b41cd030458c (patch) | |
tree | 15f33e0d7d60c89de5508ff515acd3807a113ac5 /drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |
parent | cf4197ed5796234a53beb71228198c7d1e678947 (diff) |
drm/amdgpu: Fix DEBUG_LOCKS_WARN_ON(depth <= 0) in amdgpu_ctx.lock
If CS is submitted using guilty ctx, we terminate amdgpu_cs_parser_init
before locking ctx->lock, latter in amdgpu_cs_parser_fini we still are
trying to release the lock just becase parser->ctx != NULL.
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 663043c8f0f5..0acc8dee2cb8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -124,14 +124,14 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs | |||
124 | goto free_chunk; | 124 | goto free_chunk; |
125 | } | 125 | } |
126 | 126 | ||
127 | mutex_lock(&p->ctx->lock); | ||
128 | |||
127 | /* skip guilty context job */ | 129 | /* skip guilty context job */ |
128 | if (atomic_read(&p->ctx->guilty) == 1) { | 130 | if (atomic_read(&p->ctx->guilty) == 1) { |
129 | ret = -ECANCELED; | 131 | ret = -ECANCELED; |
130 | goto free_chunk; | 132 | goto free_chunk; |
131 | } | 133 | } |
132 | 134 | ||
133 | mutex_lock(&p->ctx->lock); | ||
134 | |||
135 | /* get chunks */ | 135 | /* get chunks */ |
136 | chunk_array_user = u64_to_user_ptr(cs->in.chunks); | 136 | chunk_array_user = u64_to_user_ptr(cs->in.chunks); |
137 | if (copy_from_user(chunk_array, chunk_array_user, | 137 | if (copy_from_user(chunk_array, chunk_array_user, |