drm/amdgpu: Fix UserQ fence iterator cleanup
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix UserQ fence iterator cleanup
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(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +1 -0
@@ -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; }
Signature · 1 line
2.56.1
Christian König
maintainerQuoted 8 lines · Erhan Bilgili
If a fallback wait is interrupted,
USERQ_WAITleaves the unwrap loop without releasing the reference taken bydma_fence_unwrap_first(). That reference is normally dropped bydma_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]>
Good catch, but we should probably fix dma_fence_unwrap() instead and add a cleanup.
I will take care of that.
Regards,
Christian.
Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c +1
-0@@ -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; }