[PATCH -fixes] ttm: Don't return the bo reserved on error path
Jerome Glisse
j.glisse at gmail.com
Mon Nov 21 17:00:42 PST 2011
On Mon, Nov 21, 2011 at 01:05:02PM +0100, Thomas Hellstrom wrote:
> An unlikely race could case a bo to be returned reserved on an error path.
>
> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
Reviewed-by: Jerome Glisse <jglisse at redhat.com>
> ---
> drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> 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;
> }
> --
> 1.7.4.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list