summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-06-15 10:21:31 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-06-15 10:26:51 +0200
commitd34b2c7b9e108766b1d67cd23b8f7ecc77835ac7 (patch)
tree8855630a65d5eaac65475d016256b2f2a0fc96dc
parente1b8eabeee354822fc0a413dd097210b621eb73a (diff)
Fix refcounting / lock race.
Reported by Steve Wilkins / Michel Dänzer.
-rw-r--r--linux-core/drm_bo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index b9a261d5..2a16ba5a 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -618,6 +618,7 @@ int drm_fence_buffer_objects(drm_file_t * priv,
if (entry->fence)
drm_fence_usage_deref_locked(dev, entry->fence);
entry->fence = fence;
+ atomic_inc(&fence->usage);
DRM_FLAG_MASKED(entry->priv_flags, 0,
_DRM_BO_FLAG_UNFENCED);
DRM_WAKEUP(&entry->event_queue);
@@ -627,7 +628,6 @@ int drm_fence_buffer_objects(drm_file_t * priv,
drm_bo_usage_deref_locked(entry);
l = f_list.next;
}
- atomic_add(count, &fence->usage);
DRM_DEBUG("Fenced %d buffers\n", count);
out:
mutex_unlock(&dev->struct_mutex);