Skip to content

Commit c73a891

Browse files
ShuichengLinThomas Hellström
authored andcommitted
drm/xe: Skip address copy for sync-only execs
For parallel exec queues, xe_exec_ioctl() copied the batch buffer address array from userspace without checking num_batch_buffer. If user creates a sync-only exec that doesn't use the address field, the exec will fail with -EFAULT. Add num_batch_buffer check to skip the copy, and the exec could be executed successfully. Here is the sync-only exec: struct drm_xe_exec exec = { .extensions = 0, .exec_queue_id = qid, .num_syncs = 1, .syncs = (uintptr_t)&sync, .address = 0, /* ignored for sync-only */ .num_batch_buffer = 0, /* sync-only */ }; Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Cc: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260122214053.3189366-2-shuicheng.lin@intel.com (cherry picked from commit 4761791) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1 parent e27ada4 commit c73a891

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/gpu/drm/xe/xe_exec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
190190
goto err_syncs;
191191
}
192192

193-
if (xe_exec_queue_is_parallel(q)) {
194-
err = copy_from_user(addresses, addresses_user, sizeof(u64) *
195-
q->width);
193+
if (args->num_batch_buffer && xe_exec_queue_is_parallel(q)) {
194+
err = copy_from_user(addresses, addresses_user,
195+
sizeof(u64) * q->width);
196196
if (err) {
197197
err = -EFAULT;
198198
goto err_syncs;

0 commit comments

Comments
 (0)