drm/amdgpu: restrict userptr even more
authorChristian König <christian.koenig@amd.com>
Tue, 29 Aug 2017 14:07:31 +0000 (16:07 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 31 Aug 2017 17:46:17 +0000 (13:46 -0400)
Don't allow them to be GEM imported into another process.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

index d02880640ee7d2fd6bd2ca59a95f7496d1e0462d..e32a2b55b54f7da7ce8238c578953e1c2f912270 100644 (file)
@@ -112,7 +112,13 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
        struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
        struct amdgpu_vm *vm = &fpriv->vm;
        struct amdgpu_bo_va *bo_va;
+       struct mm_struct *mm;
        int r;
+
+       mm = amdgpu_ttm_tt_get_usermm(abo->tbo.ttm);
+       if (mm && mm != current->mm)
+               return -EPERM;
+
        r = amdgpu_bo_reserve(abo, false);
        if (r)
                return r;