Skip to content

Commit 023d22e

Browse files
Tvrtko Ursulintdz
authored andcommitted
drm/v3d: Validate passed in drm syncobj handles in the timestamp extension
If userspace provides an unknown or invalid handle anywhere in the handle array the rest of the driver will not handle that well. Fix it by checking handle was looked up successfully or otherwise fail the extension by jumping into the existing unwind. Signed-off-by: Tvrtko Ursulin <[email protected]> Fixes: 9ba0ff3 ("drm/v3d: Create a CPU job extension for the timestamp query job") Cc: Maíra Canal <[email protected]> Cc: Iago Toral Quiroga <[email protected]> Cc: [email protected] # v6.8+ Reviewed-by: Maíra Canal <[email protected]> Signed-off-by: Maíra Canal <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 8d1276d) Signed-off-by: Thomas Zimmermann <[email protected]>
1 parent 32df4ab commit 023d22e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/gpu/drm/v3d/v3d_submit.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,10 @@ v3d_get_cpu_timestamp_query_params(struct drm_file *file_priv,
498498
}
499499

500500
job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);
501+
if (!job->timestamp_query.queries[i].syncobj) {
502+
err = -ENOENT;
503+
goto error;
504+
}
501505
}
502506
job->timestamp_query.count = timestamp.count;
503507

@@ -552,6 +556,10 @@ v3d_get_cpu_reset_timestamp_params(struct drm_file *file_priv,
552556
}
553557

554558
job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);
559+
if (!job->timestamp_query.queries[i].syncobj) {
560+
err = -ENOENT;
561+
goto error;
562+
}
555563
}
556564
job->timestamp_query.count = reset.count;
557565

@@ -616,6 +624,10 @@ v3d_get_cpu_copy_query_results_params(struct drm_file *file_priv,
616624
}
617625

618626
job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync);
627+
if (!job->timestamp_query.queries[i].syncobj) {
628+
err = -ENOENT;
629+
goto error;
630+
}
619631
}
620632
job->timestamp_query.count = copy.count;
621633

0 commit comments

Comments
 (0)