Skip to content

Commit 26cc40a

Browse files
thomashvmwairlied
authored andcommitted
ttm: Don't return the bo reserved on error path
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>
1 parent cdaeb57 commit 26cc40a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/gpu/drm/ttm/ttm_bo.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,16 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo,
574574
return ret;
575575

576576
spin_lock(&glob->lru_lock);
577+
578+
if (unlikely(list_empty(&bo->ddestroy))) {
579+
spin_unlock(&glob->lru_lock);
580+
return 0;
581+
}
582+
577583
ret = ttm_bo_reserve_locked(bo, interruptible,
578584
no_wait_reserve, false, 0);
579585

580-
if (unlikely(ret != 0) || list_empty(&bo->ddestroy)) {
586+
if (unlikely(ret != 0)) {
581587
spin_unlock(&glob->lru_lock);
582588
return ret;
583589
}

0 commit comments

Comments
 (0)