* callback when a fence has already been set.
*/
if (syncobj->fence) {
- *fence = dma_fence_get(syncobj->fence);
+ *fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
+ lockdep_is_held(&syncobj->lock)));
ret = 1;
} else {
*fence = NULL;
spin_lock(&syncobj->lock);
- old_fence = syncobj->fence;
- syncobj->fence = fence;
+ old_fence = rcu_dereference_protected(syncobj->fence,
+ lockdep_is_held(&syncobj->lock));
+ rcu_assign_pointer(syncobj->fence, fence);
if (fence != old_fence) {
list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) {
container_of(cb, struct syncobj_wait_entry, syncobj_cb);
/* This happens inside the syncobj lock */
- wait->fence = dma_fence_get(syncobj->fence);
+ wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
+ lockdep_is_held(&syncobj->lock)));
wake_up_process(wait->task);
}