From: Thomas Hellstrom Date: Mon, 21 Nov 2011 12:05:02 +0000 (+0100) Subject: ttm: Don't return the bo reserved on error path X-Git-Tag: v3.2-rc3~8^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26cc40a83384178bfaefbcfb4786591498f3e190;p=profile%2Fcommon%2Fkernel-common.git 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 Reviewed-by: Jerome Glisse Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 617b646..0bb0f5f 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -574,10 +574,16 @@ retry: 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; }