Skip to content

Commit

Permalink
drm/amd/sched: NULL out the s_fence field after run_job
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Christian König <[email protected]>
Reviewed-by: Andres Rodriguez <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
  • Loading branch information
nhaehnle authored and alexdeucher committed Oct 6, 2017
1 parent 214a91e commit 29d2535
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 29d2535

Please sign in to comment.