drm/amdgpu: fix unlocks on error return path
Subsystems (3)
PATCH 1/1 drm/amdgpu: fix unlocks on error return path
From: Colin Ian King <[email protected]>
Currently the error returns paths are unlocking lock kiq->ring_lock however it seems this should be dev->gfx.kiq.ring_lock as this is the lock that is being locked and unlocked around the ring operations. This looks like a bug, fix it by unlocking the correct lock.
[ Note: untested ]
Addresses-Coverity: ("Missing unlock")
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -1
@@ -430,7 +430,7 @@ static int gmc_v10_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, r =amdgpu_fence_emit_polling (ring, &seq,MAX_KIQ_REG_WAIT );if (r) {amdgpu_ring_undo (ring); -spin_unlock (&kiq->ring_lock); +spin_unlock (&adev->gfx.kiq.ring_lock);return -ETIME ; }
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -1
@@ -624,7 +624,7 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, r =amdgpu_fence_emit_polling (ring, &seq,MAX_KIQ_REG_WAIT );if (r) {amdgpu_ring_undo (ring); -spin_unlock (&kiq->ring_lock); +spin_unlock (&adev->gfx.kiq.ring_lock);return -ETIME ; }
Signature · 1 line
2.25.1
Quoted 9 lines · Colin King
From: Colin Ian King <[email protected]>
Currently the error returns paths are unlocking lock
kiq->ring_lockhowever it seems this should bedev->gfx.kiq.ring_lockas this is the lock that is being locked and unlocked around the ring operations. This looks like a bug, fix it by unlocking the correct lock.
Quoted 5 lines
[ Note: untested ]
Addresses-Coverity: ("Missing unlock")
Fixes 82478876eaac ("drm/amdgpu: protect ring overrun")Signed-off-by Colin Ian King <[email protected]>
It's the same lock, just accessed via a local pointer. I'll take the patch and update the commit message when I apply it to avoid confusion in the future.
Alex
Quoted 38 lines
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1
-1@@ -430,7 +430,7 @@ static int gmc_v10_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, r =amdgpu_fence_emit_polling (ring, &seq,MAX_KIQ_REG_WAIT );if (r) {amdgpu_ring_undo (ring); -spin_unlock (&kiq->ring_lock); +spin_unlock (&adev->gfx.kiq.ring_lock);return -ETIME ; }drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-2@@ -624,7 +624,7 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev, r =amdgpu_fence_emit_polling (ring, &seq,MAX_KIQ_REG_WAIT );if (r) {amdgpu_ring_undo (ring); -spin_unlock (&kiq->ring_lock); +spin_unlock (&adev->gfx.kiq.ring_lock);return -ETIME ; } --2.25.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel