Skip to content

Commit 2397e3d

Browse files
olvaffealexdeucher
authored andcommitted
drm/amdgpu: add a missing lock for AMDGPU_SCHED
mgr->ctx_handles should be protected by mgr->lock. v2: improve commit message v3: add a Fixes tag Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Fixes: 52c6a62 ("drm/amdgpu: add interface for editing a foreign process's priority v3") Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 922a76b commit 2397e3d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
3838
{
3939
struct fd f = fdget(fd);
4040
struct amdgpu_fpriv *fpriv;
41+
struct amdgpu_ctx_mgr *mgr;
4142
struct amdgpu_ctx *ctx;
4243
uint32_t id;
4344
int r;
@@ -51,8 +52,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
5152
return r;
5253
}
5354

54-
idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
55+
mgr = &fpriv->ctx_mgr;
56+
mutex_lock(&mgr->lock);
57+
idr_for_each_entry(&mgr->ctx_handles, ctx, id)
5558
amdgpu_ctx_priority_override(ctx, priority);
59+
mutex_unlock(&mgr->lock);
5660

5761
fdput(f);
5862
return 0;

0 commit comments

Comments
 (0)