From d34b2c7b9e108766b1d67cd23b8f7ecc77835ac7 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 15 Jun 2007 10:21:31 +0200 Subject: Fix refcounting / lock race. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by Steve Wilkins / Michel Dänzer. --- linux-core/drm_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3