aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
diff options
context:
space:
mode:
authorAlex Deucher <[email protected]>2025-02-26 21:31:57 +0000
committerAlex Deucher <[email protected]>2025-04-08 20:48:21 +0000
commit158bfbc72c5d7675039df540b120ccdd37bca5f0 (patch)
tree3ff768779188effaca6d9ae12612d810eefff7f9 /drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
parentdrm/amdgpu: fix the memleak caused by fence not released (diff)
downloadkernel-158bfbc72c5d7675039df540b120ccdd37bca5f0.tar.gz
kernel-158bfbc72c5d7675039df540b120ccdd37bca5f0.zip
drm/amdgpu: validate user queue parameters
Make sure these are set properly to ensure compatibility if we ever update the IOCTL interface. Reviewed-by: Prike Liang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
index a78a3728f6b8..a02614cbda36 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userqueue.c
@@ -380,12 +380,26 @@ int amdgpu_userq_ioctl(struct drm_device *dev, void *data,
switch (args->in.op) {
case AMDGPU_USERQ_OP_CREATE:
+ if (args->in._pad)
+ return -EINVAL;
r = amdgpu_userqueue_create(filp, args);
if (r)
DRM_ERROR("Failed to create usermode queue\n");
break;
case AMDGPU_USERQ_OP_FREE:
+ if (args->in.ip_type ||
+ args->in.doorbell_handle ||
+ args->in.doorbell_offset ||
+ args->in._pad ||
+ args->in.queue_va ||
+ args->in.queue_size ||
+ args->in.rptr_va ||
+ args->in.wptr_va ||
+ args->in.wptr_va ||
+ args->in.mqd ||
+ args->in.mqd_size)
+ return -EINVAL;
r = amdgpu_userqueue_destroy(filp, args->in.queue_id);
if (r)
DRM_ERROR("Failed to destroy usermode queue\n");