aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_syncobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_syncobj.c')
-rw-r--r--drivers/gpu/drm/drm_syncobj.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index f776fc1cc543..9b733c510cbf 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -106,7 +106,8 @@ static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj,
106 * callback when a fence has already been set. 106 * callback when a fence has already been set.
107 */ 107 */
108 if (syncobj->fence) { 108 if (syncobj->fence) {
109 *fence = dma_fence_get(syncobj->fence); 109 *fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
110 lockdep_is_held(&syncobj->lock)));
110 ret = 1; 111 ret = 1;
111 } else { 112 } else {
112 *fence = NULL; 113 *fence = NULL;
@@ -168,8 +169,9 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
168 169
169 spin_lock(&syncobj->lock); 170 spin_lock(&syncobj->lock);
170 171
171 old_fence = syncobj->fence; 172 old_fence = rcu_dereference_protected(syncobj->fence,
172 syncobj->fence = fence; 173 lockdep_is_held(&syncobj->lock));
174 rcu_assign_pointer(syncobj->fence, fence);
173 175
174 if (fence != old_fence) { 176 if (fence != old_fence) {
175 list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { 177 list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) {
@@ -659,7 +661,8 @@ static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj,
659 container_of(cb, struct syncobj_wait_entry, syncobj_cb); 661 container_of(cb, struct syncobj_wait_entry, syncobj_cb);
660 662
661 /* This happens inside the syncobj lock */ 663 /* This happens inside the syncobj lock */
662 wait->fence = dma_fence_get(syncobj->fence); 664 wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
665 lockdep_is_held(&syncobj->lock)));
663 wake_up_process(wait->task); 666 wake_up_process(wait->task);
664} 667}
665 668