diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-09-28 11:51:32 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-10-06 17:44:30 -0400 |
commit | 29d253553559dba919315be847f4f2cce29edd42 (patch) | |
tree | 3e6973a35e3b9ee5c92d76331895010080abaf8e /drivers/gpu/drm/amd/scheduler | |
parent | 214a91e6bfabaa6cbfa692df8732000aab050795 (diff) | |
download | lwn-29d253553559dba919315be847f4f2cce29edd42.tar.gz lwn-29d253553559dba919315be847f4f2cce29edd42.zip |
drm/amd/sched: NULL out the s_fence field after run_job
amd_sched_process_job drops the fence reference, so NULL out the s_fence
field before adding it as a callback to guard against accidentally using
s_fence after it may have be freed.
v2: add a clarifying comment
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/scheduler')
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index e793312e351c..4693be20e30a 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c @@ -611,6 +611,10 @@ static int amd_sched_main(void *param) fence = sched->ops->run_job(sched_job); amd_sched_fence_scheduled(s_fence); + + /* amd_sched_process_job drops the job's reference of the fence. */ + sched_job->s_fence = NULL; + if (fence) { s_fence->parent = dma_fence_get(fence); r = dma_fence_add_callback(fence, &s_fence->cb, |