Commit 153b9e1b authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: fix locking in vega10_ih_prescreen_iv

The vm pointer can become invalid as soon as the lock is released.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d3aab672
...@@ -278,9 +278,9 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev) ...@@ -278,9 +278,9 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev)
/* Track retry faults in per-VM fault FIFO. */ /* Track retry faults in per-VM fault FIFO. */
spin_lock(&adev->vm_manager.pasid_lock); spin_lock(&adev->vm_manager.pasid_lock);
vm = idr_find(&adev->vm_manager.pasid_idr, pasid); vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
spin_unlock(&adev->vm_manager.pasid_lock);
if (WARN_ON_ONCE(!vm)) { if (WARN_ON_ONCE(!vm)) {
/* VM not found, process it normally */ /* VM not found, process it normally */
spin_unlock(&adev->vm_manager.pasid_lock);
amdgpu_ih_clear_fault(adev, key); amdgpu_ih_clear_fault(adev, key);
return true; return true;
} }
...@@ -288,9 +288,11 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev) ...@@ -288,9 +288,11 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev)
r = kfifo_put(&vm->faults, key); r = kfifo_put(&vm->faults, key);
if (!r) { if (!r) {
/* FIFO is full. Ignore it until there is space */ /* FIFO is full. Ignore it until there is space */
spin_unlock(&adev->vm_manager.pasid_lock);
amdgpu_ih_clear_fault(adev, key); amdgpu_ih_clear_fault(adev, key);
goto ignore_iv; goto ignore_iv;
} }
spin_unlock(&adev->vm_manager.pasid_lock);
/* It's the first fault for this address, process it normally */ /* It's the first fault for this address, process it normally */
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment