From: Christian König Date: Tue, 29 Aug 2017 14:07:31 +0000 (+0200) Subject: drm/amdgpu: restrict userptr even more X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4f5839c56ec38e2f8fcc59ca0e01defa8702987b;p=linux.git drm/amdgpu: restrict userptr even more Don't allow them to be GEM imported into another process. Signed-off-by: Christian König Reviewed-by: Felix Kuehling Acked-by: Chunming Zhou Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index d02880640ee7d..e32a2b55b54f7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -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;