Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26cc40a8 authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie
Browse files

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: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent cdaeb578
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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;
	}