drm/radeon: hold reference to fences in radeon_sa_bo_new (3.17 and older)
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 15 Mar 2016 17:56:45 +0000 (12:56 -0500)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Jun 2016 08:42:50 +0000 (10:42 +0200)
commitf839050dd43e02821a6a06c4a4ea35e283ccf925
tree6c26a81bacd54bb500b37631f2158716ce435511
parent7ed849b98b4504fe56d3c9493eaed5b562422d09
drm/radeon: hold reference to fences in radeon_sa_bo_new (3.17 and older)

[Backport of upstream commit f6ff4f67cdf8455d0a4226eeeaf5af17c37d05eb, with
 an additional NULL pointer guard that is required for kernels 3.17 and older.

 To be precise, any kernel that does *not* have commit 954605ca3 "drm/radeon:
 use common fence implementation for fences, v4" requires this additional
 NULL pointer guard.]

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> (v1 + fix)
Tested-by: Lutz Euler <lutz.euler@freenet.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/gpu/drm/radeon/radeon_sa.c