If a fallback wait is interrupted, USERQ_WAIT leaves the unwrap loop
without releasing the reference taken by dma_fence_unwrap_first().
That reference is normally dropped by dma_fence_chain_walk().

Drop iter.chain before returning the error.

Fixes: 15e30a6e4792 ("drm/amdgpu: Add wait IOCTL timeline syncobj support")
Signed-off-by: Erhan Bilgili <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index dd976a50e053..e7b63c227421 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -796,6 +796,7 @@ amdgpu_userq_wait_return_fence_info(struct drm_device *dev, 
struct drm_file *fil
                        r = amdgpu_userq_wait_add_fence(wait_info, fences,
                                                        &num_fences, f);
                        if (r) {
+                               dma_fence_put(iter.chain);
                                dma_fence_put(fence);
                                goto free_fences;
                        }
-- 
2.56.1

Reply via email to