Skip to content

Commit 8d5e1e5

Browse files
nhaehnlegregkh
authored andcommitted
drm/radeon: hold reference to fences in radeon_sa_bo_new
commit f6ff4f6 upstream. An arbitrary amount of time can pass between spin_unlock and radeon_fence_wait_any, so we need to ensure that nobody frees the fences from under us. Based on the analogous fix for amdgpu. Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cb071fb commit 8d5e1e5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/gpu/drm/radeon/radeon_sa.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,13 @@ int radeon_sa_bo_new(struct radeon_device *rdev,
349349
/* see if we can skip over some allocations */
350350
} while (radeon_sa_bo_next_hole(sa_manager, fences, tries));
351351

352+
for (i = 0; i < RADEON_NUM_RINGS; ++i)
353+
radeon_fence_ref(fences[i]);
354+
352355
spin_unlock(&sa_manager->wq.lock);
353356
r = radeon_fence_wait_any(rdev, fences, false);
357+
for (i = 0; i < RADEON_NUM_RINGS; ++i)
358+
radeon_fence_unref(&fences[i]);
354359
spin_lock(&sa_manager->wq.lock);
355360
/* if we have nothing to wait for block */
356361
if (r == -ENOENT && block) {

0 commit comments

Comments
 (0)