[PATCH] drm/amdgpu: revert allow write access to mapped userptrs"

Christian König ckoenig.leichtzumerken at gmail.com
Mon Jun 24 09:10:40 UTC 2024


This reverts commit 358c258a816baed4c6997b59c2117578a1360498.

Jerome actually pointed out why that stuff doesn't work in 2016:
https://lists.freedesktop.org/archives/dri-devel/2016-March/103062.html

Unfortunately the revert somehow got lost.

Signed-off-by: Christian König <christian.koenig at amd.com>
Fixes: 358c258a816baed4c6997b59c2117578a1360498
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 3adaa4670103..331969b96a5a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -433,10 +433,12 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
 	    AMDGPU_GEM_USERPTR_REGISTER))
 		return -EINVAL;
 
-	if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) &&
-	     !(args->flags & AMDGPU_GEM_USERPTR_REGISTER)) {
+	if (!(args->flags & AMDGPU_GEM_USERPTR_READONLY) && (
+	     !(args->flags & AMDGPU_GEM_USERPTR_ANONONLY) ||
+	     !(args->flags & AMDGPU_GEM_USERPTR_REGISTER))) {
 
-		/* if we want to write to it we must install a MMU notifier */
+		/* if we want to write to it we must require anonymous
+		   memory and install a MMU notifier */
 		return -EACCES;
 	}
 
-- 
2.34.1



More information about the amd-gfx mailing list