Skip to content

Commit

Permalink
ttm: Don't return the bo reserved on error path
Browse files Browse the repository at this point in the history
An unlikely race could case a bo to be returned reserved on an error path.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Thomas Hellstrom authored and Dave Airlie committed Nov 22, 2011
1 parent cdaeb57 commit 26cc40a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,16 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
return ret;

spin_lock(&glob->lru_lock);

if (unlikely(list_empty(&bo->ddestroy))) {
spin_unlock(&glob->lru_lock);
return 0;
}

ret = ttm_bo_reserve_locked(bo, interruptible,
no_wait_reserve, false, 0);

if (unlikely(ret != 0) || list_empty(&bo->ddestroy)) {
if (unlikely(ret != 0)) {
spin_unlock(&glob->lru_lock);
return ret;
}
Expand Down

0 comments on commit 26cc40a

Please sign in to comment.