drm/amdgpu: fix user ptr race condition
authorChristian König <christian.koenig@amd.com>
Wed, 3 Jun 2015 19:31:20 +0000 (21:31 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 5 Jun 2015 14:59:32 +0000 (10:59 -0400)
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: monk liu <monk.liu@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index ad5b9c676fd8b59ce19bea29313b3f4ee7aa8cf5..e8409fea4bf18c43ff8eebdb6124159089ea37fe 100644 (file)
@@ -37,6 +37,7 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
        if (robj) {
                if (robj->gem_base.import_attach)
                        drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
+               amdgpu_mn_unregister(robj);
                amdgpu_bo_unref(&robj);
        }
 }
index 7d801e016e31ad22a9fccb8636f5e4aa678a5e85..8da64245b31b924e85561cad158e80b159f639c6 100644 (file)
@@ -95,7 +95,6 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
        bo = container_of(tbo, struct amdgpu_bo, tbo);
 
        amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
-       amdgpu_mn_unregister(bo);
 
        mutex_lock(&bo->adev->gem.mutex);
        list_del_init(&bo->list);