Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/radeon: hold reference to fences in radeon_sa_bo_new

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>
Cc: stable@vger.kernel.org

authored by

Nicolai Hähnle and committed by
Alex Deucher
f6ff4f67 b19763d0

+5
+5
drivers/gpu/drm/radeon/radeon_sa.c
··· 349 349 /* see if we can skip over some allocations */ 350 350 } while (radeon_sa_bo_next_hole(sa_manager, fences, tries)); 351 351 352 + for (i = 0; i < RADEON_NUM_RINGS; ++i) 353 + radeon_fence_ref(fences[i]); 354 + 352 355 spin_unlock(&sa_manager->wq.lock); 353 356 r = radeon_fence_wait_any(rdev, fences, false); 357 + for (i = 0; i < RADEON_NUM_RINGS; ++i) 358 + radeon_fence_unref(&fences[i]); 354 359 spin_lock(&sa_manager->wq.lock); 355 360 /* if we have nothing to wait for block */ 356 361 if (r == -ENOENT) {