Revert "drm/amdgpu: fix a potential deadlock in amdgpu_bo_create_restricted()"
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 14 Feb 2017 08:47:36 +0000 (09:47 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Mar 2017 03:53:06 +0000 (23:53 -0400)
This reverts commit 38fc4856ad98f230bc91da0421dec69e4aee40f8, which
introduces a use-after-free.

The underlying bug should be properly fixed with "drm/ttm: never add BO
that failed to validate to the LRU list".

Cc: zhoucm1 <david1.zhou@amd.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index be80a4a68d7b05e63d22ff68a310830d7f1477cc..6a609a25b3fa8a781569e266ddb8415856513286 100644 (file)
@@ -411,11 +411,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
        amdgpu_cs_report_moved_bytes(adev,
                atomic64_read(&adev->num_bytes_moved) - initial_bytes_moved);
 
-       if (unlikely(r != 0)) {
-               if (!resv)
-                       ww_mutex_unlock(&bo->tbo.resv->lock);
+       if (unlikely(r != 0))
                return r;
-       }
 
        bo->tbo.priority = ilog2(bo->tbo.num_pages);
        if (kernel)