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>
This commit is contained in:
parent
cdaeb578ac
commit
26cc40a833
1 changed files with 7 additions and 1 deletions
|
@ -574,10 +574,16 @@ retry:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
spin_lock(&glob->lru_lock);
|
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,
|
ret = ttm_bo_reserve_locked(bo, interruptible,
|
||||||
no_wait_reserve, false, 0);
|
no_wait_reserve, false, 0);
|
||||||
|
|
||||||
if (unlikely(ret != 0) || list_empty(&bo->ddestroy)) {
|
if (unlikely(ret != 0)) {
|
||||||
spin_unlock(&glob->lru_lock);
|
spin_unlock(&glob->lru_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue