[PATCH] drm/xe: check mask in xe_wait_user_fence_ioctl()

Francois Dugast francois.dugast at intel.com
Fri Dec 8 14:34:27 UTC 2023


Check the drm_xe_wait_user_fence mask is one of the allowed values
DRM_XE_UFENCE_WAIT_MASK_* provided in xe_drm.h.

Signed-off-by: Francois Dugast <francois.dugast at intel.com>
---
 drivers/gpu/drm/xe/xe_wait_user_fence.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
index 4d5c2555ce41..a73139fe3fe0 100644
--- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
+++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
@@ -164,6 +164,12 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
 	if (XE_IOCTL_DBG(xe, args->num_engines > XE_HW_ENGINE_MAX_INSTANCE))
 		return -EINVAL;
 
+	if (XE_IOCTL_DBG(xe, args->mask != DRM_XE_UFENCE_WAIT_MASK_U8 &&
+			 args->mask != DRM_XE_UFENCE_WAIT_MASK_U16 &&
+			 args->mask != DRM_XE_UFENCE_WAIT_MASK_U32 &&
+			 args->mask != DRM_XE_UFENCE_WAIT_MASK_U64))
+		return -EINVAL;
+
 	if (!no_engines) {
 		err = copy_from_user(eci, user_eci,
 				     sizeof(struct drm_xe_engine_class_instance) *
-- 
2.34.1



More information about the Intel-xe mailing list