From: jsg Date: Tue, 13 Jun 2023 02:54:09 +0000 (+0000) Subject: drm/amdgpu: add a missing lock for AMDGPU_SCHED X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e80e918f5c06f10633115cc3d7e603b912c3aab4;p=openbsd drm/amdgpu: add a missing lock for AMDGPU_SCHED From Chia-I Wu 7887397338a55a2439ba8db6d9a93cbe4094d912 in linux-6.1.y/6.1.29 2397e3d8d2e120355201a8310b61929f5a8bd2c0 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_sched.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_sched.c index 13b7d18cd9e..6f57e9c5774 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_sched.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_sched.c @@ -41,6 +41,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev, #ifdef notyet struct fd f = fdget(fd); struct amdgpu_fpriv *fpriv; + struct amdgpu_ctx_mgr *mgr; struct amdgpu_ctx *ctx; uint32_t id; int r; @@ -54,8 +55,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev, return r; } - idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id) + mgr = &fpriv->ctx_mgr; + mutex_lock(&mgr->lock); + idr_for_each_entry(&mgr->ctx_handles, ctx, id) amdgpu_ctx_priority_override(ctx, priority); + mutex_unlock(&mgr->lock); fdput(f); return 0;